src/java.base/unix/native/libnet/net_util_md.c
changeset 52491 23b3a46fa159
parent 52073 1c8745e31fa3
child 52499 768b1c612100
--- a/src/java.base/unix/native/libnet/net_util_md.c	Fri Nov 09 10:52:15 2018 +0100
+++ b/src/java.base/unix/native/libnet/net_util_md.c	Mon Nov 12 12:55:36 2018 +0000
@@ -803,8 +803,12 @@
 
 #ifdef __linux__
         /*
-         * On Linux if we are connecting to a link-local address
-         * we need to specify the interface in the scope_id (2.4 kernel only)
+         * On Linux if we are connecting to a
+         *
+         *   - link-local address
+         *   - multicast interface-local or link-local address
+         *
+         * we need to specify the interface in the scope_id.
          *
          * If the scope was cached then we use the cached value. If not cached but
          * specified in the Inet6Address we use that, but we first check if the
@@ -814,7 +818,9 @@
          * we try to determine a value from the routing table. In all these
          * cases the used value is cached for further use.
          */
-        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)) {
+        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)
+            || IN6_IS_ADDR_MC_NODELOCAL(&sa->sa6.sin6_addr)
+            || IN6_IS_ADDR_MC_LINKLOCAL(&sa->sa6.sin6_addr)) {
             unsigned int cached_scope_id = 0, scope_id = 0;
 
             if (ia6_cachedscopeidID) {