United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7132637 (dc) DatagramChannel multicast tests failing on MacOSX
7132637 : (dc) DatagramChannel multicast tests failing on MacOSX

Details
Type:
Bug
Submit Date:
2012-01-23
Status:
Closed
Updated Date:
2012-10-06
Project Name:
JDK
Resolved Date:
2012-03-27
Component:
core-libs
OS:
os_x
Sub-Component:
java.nio
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u4
Fixed Versions:
7u4

Related Reports
Relates:

Sub Tasks

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;
                                     
2012-01-29
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.
                                     
2012-01-24



Hardware and Software, Engineered to Work Together