changeset 4699:63b6953bbcfa

7132637: (dc) DatagramChannel multicast tests failing on MacOSX Reviewed-by: alanb
author michaelm
date Mon, 30 Jan 2012 13:40:20 +0000
parents 7929ac999cde
children 6f7d14fd7d8f
files src/solaris/native/sun/nio/ch/Net.c
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/nio/ch/Net.c	Mon Jan 30 07:43:40 2012 +0000
+++ b/src/solaris/native/sun/nio/ch/Net.c	Mon Jan 30 13:40:20 2012 +0000
@@ -198,7 +198,12 @@
 JNIEXPORT jboolean JNICALL
 Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
 {
+#ifdef MACOSX
+    /* 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 MACOSX
+        /* 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 MACOSX
+    /* 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(MACOSX)
+        /* Include-mode filtering broken on Mac OS & Linux at least to 2.6.24 */
         return IOS_UNAVAILABLE;
 #else
         initGroupSourceReq(env, group, index, source, &req);
@@ -590,6 +605,10 @@
                                     jbyteArray group, jint index, jbyteArray source)
 {
 #ifdef AF_INET6
+  #ifdef MACOSX
+    /* 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;