--- a/src/java.base/unix/native/libnet/net_util_md.c Mon Apr 16 10:19:05 2018 +0100
+++ b/src/java.base/unix/native/libnet/net_util_md.c Mon Apr 16 10:27:52 2018 +0100
@@ -89,7 +89,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;