From owner-freebsd-java Sat Mar 8 18:28:40 2003 Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B778F37B401 for ; Sat, 8 Mar 2003 18:28:38 -0800 (PST) Received: from fafoe.dyndns.org (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id F059543F75 for ; Sat, 8 Mar 2003 18:28:37 -0800 (PST) (envelope-from stefan@fafoe.dyndns.org) Received: from frog.fafoe (frog.fafoe [192.168.2.101]) by fafoe.dyndns.org (Postfix) with ESMTP id D4E754061 for ; Sun, 9 Mar 2003 03:28:35 +0100 (CET) Received: by frog.fafoe (Postfix, from userid 1001) id DDEA34AE; Sun, 9 Mar 2003 03:28:34 +0100 (CET) Date: Sun, 9 Mar 2003 03:28:34 +0100 From: Stefan Farfeleder To: java@FreeBSD.org Subject: jdk14 MulticastSocket breakage Message-ID: <20030309022834.GA585@frog.fafoe> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.3i Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org [please CC me, thanks] Hi, I think I've found a bug in the java/jdk14 port. The method java.net.MulticastSocket.joinGroup() always fails with "java.net.SocketException: Invalid argument" (a small program to demonstrate this can be found at http://stud3.tuwien.ac.at/~e0026813/FreeBSD/multicast.java ). With ktrace I've tracked this down to: 1216 java CALL setsockopt(0x6,0,0x1,0xbf8e5b80,0x8) 1216 java RET setsockopt -1 errno 22 Invalid argument Then I looked into the source code and found that bsd-jdk14-patches-3.tar.gz made these changes to j2se/src/solaris/native/java/net/PlainDatagramSocketImpl.c - if (JVM_SetSockOpt(fd, IPPROTO_IP, (join ? IP_ADD_MEMBERSHIP:IP_DROP_MEMBERSHIP), +// XXXBSD: fix for BSD (re-implement with KAME ?) +// if (JVM_SetSockOpt(fd, IPPROTO_IP, (join ? IP_ADD_MEMBERSHIP:IP_DROP_MEMBERSHIP), + if (JVM_SetSockOpt(fd, IPPROTO_IP, (join ? 1 : 0), which I do not understand. has 12 for IP_ADD_MEMBERSHIP and 13 for IP_DROP_MEMBERSHIP, the 1 corresponds to IP_OPTIONS and causes the EINVAL failure. Reverting these changes and recompiling jdk14 fixes the failure for me. The patch also changes IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP into 1 and 0 which seems bogus too. These constants are available on Linux but not on FreeBSD; I think the values IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP should be used instead. Regards, Stefan Farfeleder To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message