From garrigue@kurims.kyoto-u.ac.jp  Tue Nov 26 06:47:59 2002
Return-Path: <garrigue@kurims.kyoto-u.ac.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CE76E37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 06:47:59 -0800 (PST)
Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7739943EAF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 06:47:50 -0800 (PST)
	(envelope-from garrigue@kurims.kyoto-u.ac.jp)
Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17])
	by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id XAA01573
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 23:47:42 +0900
Message-Id: <20021126234739H.garrigue@kurims.kyoto-u.ac.jp>
Date: Tue, 26 Nov 2002 23:47:39 +0900
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Subject: linux-sun-jdk1.4.1 calls SIOCGIFCONF ioctl with null buffer

>Number:         45753
>Category:       kern
>Synopsis:       linux-sun-jdk1.4.1 calls SIOCGIFCONF ioctl with null buffer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bms
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 26 06:50:00 PST 2002
>Closed-Date:    Tue Nov 02 07:01:50 GMT 2004
>Last-Modified:  Tue Nov 02 07:01:50 GMT 2004
>Originator:     Jacques Garrigue
>Release:        FreeBSD 5.0-DP2 i386
>Organization:
Kyoto University RIMS
>Environment:
System: FreeBSD tet.kurims.kyoto-u.ac.jp 5.0-DP2 FreeBSD 5.0-DP2 #2: Wed Nov 20 08:52:26 JST 2002 garrigue@tet.kurims.kyoto-u.ac.jp:/usr/src/sys/i386/compile/TET i386

>Description:
Sun's linux jdk1.4.1 implements java.net.NetworkInterface.getNetworkInterfaces
by first calling SIOCGIFCONF with a NULL buffer, expecting the buffer size as
result.
This call pattern was not implemented /sys/compat/linux/linux_ioctl.c.
The following patch appears to solve the problem.

>How-To-Repeat:
Calling java.net.NetworkInterface.getNetworkInterfaces() returns null.

>Fix:
Apply the following patch

--- linux_ioctl.c.diffs begins here ---
*** linux_ioctl.c.orig	Sat Nov 16 18:07:31 2002
--- linux_ioctl.c	Tue Nov 26 18:24:46 2002
***************
*** 1978,1983 ****
--- 1978,1997 ----
  	if (error != 0)
  		return (error);
  
+         /* special case used by JDK: uifc.ifc_buf is NULL */
+         if (ifc.ifc_buf == 0) {
+                 ifc.ifc_len = 0;
+                 TAILQ_FOREACH(ifp, &ifnet, if_link) {
+                         TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+                                 struct sockaddr *sa = ifa->ifa_addr;
+                                 if (sa->sa_family == AF_INET)
+                                         ifc.ifc_len += sizeof ifr;
+                         }
+                 }
+                 error = copyout(&ifc, uifc, sizeof ifc);
+                 return (error);
+         }       
+ 
  	/* much easier to use uiomove than keep track ourselves */
  	iov.iov_base = ifc.ifc_buf;
  	iov.iov_len = ifc.ifc_len;
--- linux_ioctl.c.diffs ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->emulation 
Responsible-Changed-By: bms 
Responsible-Changed-When: Fri Jun 18 12:11:09 GMT 2004 
Responsible-Changed-Why:  
One for the emulation team 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45753 
State-Changed-From-To: open->patched 
State-Changed-By: bms 
State-Changed-When: Fri Jun 18 14:06:47 GMT 2004 
State-Changed-Why:  
Committed to HEAD with cleanups, thanks! 


Responsible-Changed-From-To: emulation->bms 
Responsible-Changed-By: bms 
Responsible-Changed-When: Fri Jun 18 14:06:47 GMT 2004 
Responsible-Changed-Why:  
I'll take this as it's net related 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45753 
State-Changed-From-To: patched->closed 
State-Changed-By: bms 
State-Changed-When: Tue Nov 2 07:01:38 GMT 2004 
State-Changed-Why:  
RELENG_5 has now been branched as -STABLE 


http://www.freebsd.org/cgi/query-pr.cgi?pr=45753 
>Unformatted:
