changeset 13312:ebe635565ff3

8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address Reviewed-by: clanger, chegar Contributed-by: joelpelaez@gmail.com
author robm
date Fri, 19 Oct 2018 10:30:26 -0700
parents 4a782529d712
children d08372424e32
files src/solaris/native/java/net/net_util_md.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/net/net_util_md.c	Wed Oct 17 06:54:17 2018 -0400
+++ b/src/solaris/native/java/net/net_util_md.c	Fri Oct 19 10:30:26 2018 -0700
@@ -96,7 +96,9 @@
     }
     int defaultIndex;
     struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him;
-    if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0)) {
+    if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0) &&
+            (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) ||
+             IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) {
         defaultIndex = (*env)->GetStaticIntField(env, ni_class,
                                                  ni_defaultIndexID);
         sin6->sin6_scope_id = defaultIndex;