< prev index next >

src/java.base/unix/native/libnet/PlainSocketImpl.c

Print this page
rev 14411 : 8148424: Support IPv6-only Unix environments
Reviewed-by: alanb, chegar

@@ -213,19 +213,14 @@
         NET_ThrowNew(env, errno, "can't create socket");
         return;
     }
 
 #ifdef AF_INET6
-    /* Disable IPV6_V6ONLY to ensure dual-socket support */
+    /* Set IPV6_V6ONLY=0, to request a dual-stack socket, if supported */
     if (domain == AF_INET6) {
         int arg = 0;
-        if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
-                       sizeof(int)) < 0) {
-            NET_ThrowNew(env, errno, "cannot set IPPROTO_IPV6");
-            close(fd);
-            return;
-        }
+        setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, sizeof(int));
     }
 #endif /* AF_INET6 */
 
     /*
      * If this is a server socket then enable SO_REUSEADDR
< prev index next >