JDK-7132637 : (dc) DatagramChannel multicast tests failing on MacOSX
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-01-23
  • Updated: 2012-10-06
  • Resolved: 2012-03-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u4 b11Fixed
Related Reports
Relates :  
Description
Tests failing:

java/nio/channels/DatagramChannel/BasicMulticastTests.java 

api/java_nio/channels/DatagramChannel/DatagramChannel_Multicast

Comments
SUGGESTED FIX diff --git a/src/solaris/native/sun/nio/ch/Net.c b/src/solaris/native/sun/nio/ch/Net.c --- a/src/solaris/native/sun/nio/ch/Net.c +++ b/src/solaris/native/sun/nio/ch/Net.c @@ -198,7 +198,12 @@ JNIEXPORT jboolean JNICALL Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl) { +#ifdef _ALLBSD_SOURCE + // for now IPv6 sockets cannot join IPv4 multicast groups + return JNI_FALSE; +#else return JNI_TRUE; +#endif } JNIEXPORT jboolean JNICALL @@ -505,12 +510,17 @@ optval = (void*)&mreq; optlen = sizeof(mreq); } else { +#ifdef _ALLBSD_SOURCE + // no IPv4 include-mode filtering for now + return IOS_UNAVAILABLE; +#else mreq_source.imr_multiaddr.s_addr = htonl(group); mreq_source.imr_sourceaddr.s_addr = htonl(source); mreq_source.imr_interface.s_addr = htonl(interf); opt = (join) ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP; optval = (void*)&mreq_source; optlen = sizeof(mreq_source); +#endif } n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen); @@ -526,6 +536,10 @@ Java_sun_nio_ch_Net_blockOrUnblock4(JNIEnv *env, jobject this, jboolean block, jobject fdo, jint group, jint interf, jint source) { +#ifdef _ALLBSD_SOURCE + // no IPv4 exclude-mode filtering for now + return IOS_UNAVAILABLE; +#else struct my_ip_mreq_source mreq_source; int n; int opt = (block) ? IP_BLOCK_SOURCE : IP_UNBLOCK_SOURCE; @@ -542,6 +556,7 @@ handleSocketError(env, errno); } return 0; +#endif } JNIEXPORT jint JNICALL @@ -561,8 +576,8 @@ optval = (void*)&mreq6; optlen = sizeof(mreq6); } else { -#ifdef __linux__ - /* Include-mode filtering broken on Linux at least to 2.6.24 */ +#if defined(__linux__) || defined(_ALLBSD_SOURCE) + // no IPv6 include-mode filtering for now return IOS_UNAVAILABLE; #else initGroupSourceReq(env, group, index, source, &req); @@ -590,6 +605,10 @@ jbyteArray group, jint index, jbyteArray source) { #ifdef AF_INET6 + #ifdef _ALLBSD_SOURCE + // no IPv6 exclude-mode filtering for now + return IOS_UNAVAILABLE; + #else struct my_group_source_req req; int n; int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE; @@ -604,6 +623,7 @@ handleSocketError(env, errno); } return 0; + #endif #else JNU_ThrowInternalError(env, "Should not get here"); return IOS_THROWN;
29-01-2012

EVALUATION I ran the jtreg and JCK tests for DatagramChannel on 10.6.8 and only observed two regression tests failing: java/nio/channels/DatagramChannel/SelectWhenRefused.java - covered by 7132679. java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java - fails because the test attempts to join an IPv4 mutlicast group with an IPv6 - see comments.
24-01-2012