From owner-freebsd-bugs Tue Nov 26 6:50: 7 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF37937B401 for ; Tue, 26 Nov 2002 06:50:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A7C843EA9 for ; Tue, 26 Nov 2002 06:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gAQEo1x3084643 for ; Tue, 26 Nov 2002 06:50:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gAQEo1Gi084642; Tue, 26 Nov 2002 06:50:01 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE76E37B401 for ; 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 ; 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 ; 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 To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/45753: linux-sun-jdk1.4.1 calls SIOCGIFCONF ioctl with null buffer Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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