-/* $OpenBSD: mld6.c,v 1.59 2022/09/04 06:49:11 jsg Exp $ */
+/* $OpenBSD: mld6.c,v 1.60 2022/09/05 15:47:39 bluhm Exp $ */
/* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */
/*
static struct ip6_pktopts ip6_opts;
int mld6_timers_are_running; /* [N] shortcut for fast timer */
-/* XXX: These are necessary for KAME's link-local hack */
-static struct in6_addr mld_all_nodes_linklocal = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
-static struct in6_addr mld_all_routers_linklocal = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
void mld6_checktimer(struct ifnet *);
static void mld6_sendpkt(struct in6_multi *, int, const struct in6_addr *);
void
mld6_start_listening(struct in6_multi *in6m)
{
+ /* XXX: These are necessary for KAME's link-local hack */
+ struct in6_addr all_nodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
+
/*
* RFC2710 page 10:
* The node never sends a Report or Done for the link-scope all-nodes
* MLD messages are never sent for multicast addresses whose scope is 0
* (reserved) or 1 (node-local).
*/
- mld_all_nodes_linklocal.s6_addr16[1] = htons(in6m->in6m_ifidx);/* XXX */
- if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld_all_nodes_linklocal) ||
- __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) < __IPV6_ADDR_SCOPE_LINKLOCAL) {
+ all_nodes.s6_addr16[1] = htons(in6m->in6m_ifidx);
+ if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &all_nodes) ||
+ __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) <
+ __IPV6_ADDR_SCOPE_LINKLOCAL) {
in6m->in6m_timer = 0;
in6m->in6m_state = MLD_OTHERLISTENER;
} else {
void
mld6_stop_listening(struct in6_multi *in6m)
{
- mld_all_nodes_linklocal.s6_addr16[1] = htons(in6m->in6m_ifidx);/* XXX */
- mld_all_routers_linklocal.s6_addr16[1] =
- htons(in6m->in6m_ifidx); /* XXX: necessary when mrouting */
+ /* XXX: These are necessary for KAME's link-local hack */
+ struct in6_addr all_nodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
+ struct in6_addr all_routers = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
+
+ all_nodes.s6_addr16[1] = htons(in6m->in6m_ifidx);
+ /* XXX: necessary when mrouting */
+ all_routers.s6_addr16[1] = htons(in6m->in6m_ifidx);
if (in6m->in6m_state == MLD_IREPORTEDLAST &&
- (!IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &mld_all_nodes_linklocal)) &&
- __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) > __IPV6_ADDR_SCOPE_INTFACELOCAL)
- mld6_sendpkt(in6m, MLD_LISTENER_DONE,
- &mld_all_routers_linklocal);
+ (!IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &all_nodes)) &&
+ __IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) >
+ __IPV6_ADDR_SCOPE_INTFACELOCAL)
+ mld6_sendpkt(in6m, MLD_LISTENER_DONE, &all_routers);
}
void
struct in6_multi *in6m;
struct ifmaddr *ifma;
int timer; /* timer value in the MLD query header */
+ /* XXX: These are necessary for KAME's link-local hack */
+ struct in6_addr all_nodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
IP6_EXTHDR_GET(mldh, struct mld_hdr *, m, off, sizeof(*mldh));
if (mldh == NULL) {
timer = ntohs(mldh->mld_maxdelay)*PR_FASTHZ/MLD_TIMER_SCALE;
if (timer == 0 && mldh->mld_maxdelay)
timer = 1;
- mld_all_nodes_linklocal.s6_addr16[1] =
- htons(ifp->if_index); /* XXX */
+ all_nodes.s6_addr16[1] = htons(ifp->if_index);
TAILQ_FOREACH(ifma, &ifp->if_maddrlist, ifma_list) {
if (ifma->ifma_addr->sa_family != AF_INET6)
continue;
in6m = ifmatoin6m(ifma);
- if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr,
- &mld_all_nodes_linklocal) ||
+ if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr, &all_nodes) ||
__IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) <
__IPV6_ADDR_SCOPE_LINKLOCAL)
continue;