jdk14 MulticastSocket breakage

jdk14 MulticastSocket breakage

Post by Stefan Farfeled » Mon, 10 Mar 2003 11:29:32



[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.  <netinet/in.h> 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


with "unsubscribe freebsd-java" in the body of the message

 
 
 

jdk14 MulticastSocket breakage

Post by James Satterfiel » Tue, 11 Mar 2003 00:49:02


Stefan,
You are my new best friend! After making the change you suggested, DVArchive
FINALLY works on freebsd with the native jdk1.4.1.
Just wanted to say thank you.
James.

----- Original Message -----


Sent: Saturday, March 08, 2003 6:28 PM
Subject: jdk14 MulticastSocket breakage

> [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),
Quote:> +// XXXBSD: fix for BSD (re-implement with KAME ?)
> +//     if (JVM_SetSockOpt(fd, IPPROTO_IP, (join ?

IP_ADD_MEMBERSHIP:IP_DROP_MEMBERSHIP),

- Show quoted text -

> +       if (JVM_SetSockOpt(fd, IPPROTO_IP, (join ? 1 : 0),

> which I do not understand.  <netinet/in.h> 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


> with "unsubscribe freebsd-java" in the body of the message


with "unsubscribe freebsd-java" in the body of the message

 
 
 

1. linux-sun-jdk14 build is interactive

I think you need something like that.

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/java/linux-sun-jdk14/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- Makefile    7 Mar 2003 06:04:43 -0000       1.26

 NO_CDROM=      "License does not allow distribution with fee"
 RESTRICTED=    "Redistribution of repackaged binaries not permitted"

-EXTRACT_CMD=           # empty
-EXTRACT_BEFORE_ARGS=   # empty
-EXTRACT_AFTER_ARGS=    # empty
-
 WRKSRC=                ${WRKDIR}/j2sdk${DL_JDK_VERSION}
 PLIST_SUB+=    T=${APP_HOME:S/^${PREFIX}\///} PORTVERSION=${PORTVERSION}

 pre-everything::

-post-fetch:

+do-extract:


+       && ${TAIL} +276 ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} > ${WRKDIR}/install.sfx \
+       && ${CHMOD} +x ${WRKDIR}/install.sfx \
+       && ${WRKDIR}/install.sfx > /dev/null

 post-patch:
        ${FIND} ${WRKSRC} -name '*.orig' -print | xargs ${RM} -f


with "unsubscribe freebsd-java" in the body of the message

2. Kermit - How do I escape to a local kermit from a telnet session?

3. java/50729: java/jdk14: broken java.net.NetworkInterface calls

4. Which files??

5. java/jdk14 broken java.net.NetworkInterface (SIOCGIFCONF)

6. tcplogd like program

7. java/52302: jdk14 runnaway processes

8. NFS for slackware installations

9. Jakarta-Tomcat 4.1.18 + FreeBSD + linux-sun-jdk14 won't start ...

10. java/50729: java/jdk14: broken java.net.NetworkInterface calls

11. jdk14 no go on freebsd release 5.0p3

12. tomcat on linux-jdk14 VM dies

13. linux-sun-jdk14 build is interactive