]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Use scope id when address is link-local for IPv6 multicast IPV6_JOIN_GROUP
authorDanny Mayer <mayer@ntp.org>
Sun, 30 Nov 2003 01:52:42 +0000 (20:52 -0500)
committerDanny Mayer <mayer@ntp.org>
Sun, 30 Nov 2003 01:52:42 +0000 (20:52 -0500)
bk: 3fc94d6aeDBM8MbxsUuuq-JD-3qc3g

ntpd/ntp_io.c

index fd92cb0813937e84245c3096ade063b1dfbda837..e7a820ba9464f09b6f78de6a48eb06915dbaffdc 100644 (file)
@@ -812,10 +812,17 @@ io_multicast_add(
                }
 
                /*
-                * enable reception of multicast packets
+                * Enable reception of multicast packets
+                * If the address is link-local we can get the interface index
+                * from the scope id. Don't do this for other types of multicast
+                * addresses. For now let the kernel figure it out.
                 */
                mreq6.ipv6mr_multiaddr = iaddr6;
-               mreq6.ipv6mr_interface = inter_list[i].ifindex;
+               if (IN6_IS_ADDR_MC_LINKLOCAL(&iaddr6))
+                       mreq6.ipv6mr_interface = sin6p->sin6_scope_id;
+               else
+                       mreq6.ipv6mr_interface = 0;
+
                if(setsockopt(inter_list[i].fd, IPPROTO_IPV6, IPV6_JOIN_GROUP,
                   (char *)&mreq6, sizeof(mreq6)) == -1)
                        netsyslog(LOG_ERR,