< prev index next >

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

Print this page

        

@@ -701,10 +701,14 @@
     memset((char *)&sa, 0, sizeof(SOCKETADDRESS));
     memcpy((void *)&sa.sa6.sin6_addr, caddr, sizeof(struct in6_addr));
     sa.sa6.sin6_family = AF_INET6;
     if (scope > 0) {
         sa.sa6.sin6_scope_id = scope;
+#if defined(__linux__)
+    } else {
+        sa.sa6.sin6_scope_id = getDefaultIPv6Interface(&sa.sa6.sin6_addr);
+#endif
     }
 
     // load network interface address to SOCKETADDRESS, if specified
     if (!(IS_NULL(ifArray))) {
         memset((char *)caddr, 0, 16);
< prev index next >