src/java.base/unix/native/libnio/ch/Net.c
changeset 54627 22323f20401b
parent 54246 f04e3492fd88
child 55753 b9798272720b
child 57339 40fdbdd92617
--- a/src/java.base/unix/native/libnio/ch/Net.c	Thu Apr 25 18:41:52 2019 -0400
+++ b/src/java.base/unix/native/libnio/ch/Net.c	Tue Apr 16 13:16:49 2019 -0700
@@ -216,8 +216,10 @@
         return handleSocketError(env, errno);
     }
 
-    /* Disable IPV6_V6ONLY to ensure dual-socket support */
-    if (domain == AF_INET6) {
+    /*
+     * If IPv4 is available, disable IPV6_V6ONLY to ensure dual-socket support.
+     */
+    if (domain == AF_INET6 && ipv4_available()) {
         int arg = 0;
         if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
                        sizeof(int)) < 0) {