From: Danny Mayer Date: Sun, 30 Nov 2003 01:52:42 +0000 (-0500) Subject: Use scope id when address is link-local for IPv6 multicast IPV6_JOIN_GROUP X-Git-Tag: NTP_4_2_3~193^2~3^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08e24c7f81c044dfc2155ead2bc3200086fa9076;p=thirdparty%2Fntp.git Use scope id when address is link-local for IPv6 multicast IPV6_JOIN_GROUP bk: 3fc94d6aeDBM8MbxsUuuq-JD-3qc3g --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index fd92cb0813..e7a820ba94 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -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,