Skip site navigation (1)Skip section navigation (2)
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:   kern/45753: linux-sun-jdk1.4.1 calls SIOCGIFCONF ioctl with null buffer
Message-ID:  <20021126234739H.garrigue@kurims.kyoto-u.ac.jp>

next in thread | raw e-mail | index | archive | help

>Number:         45753
>Category:       kern
>Synopsis:       linux-sun-jdk1.4.1 calls SIOCGIFCONF ioctl with null buffer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 26 06:50:00 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021126234739H.garrigue>