diff options
author | qingli <qingli@FreeBSD.org> | 2010-01-05 22:28:23 +0000 |
---|---|---|
committer | qingli <qingli@FreeBSD.org> | 2010-01-05 22:28:23 +0000 |
commit | 60e03ff57430c89402d145108b1ad28dac62c7a0 (patch) | |
tree | 9190164df7a3f039d1a5b414e335e68fa5e9cb91 /sys/netinet6/nd6.c | |
parent | ea5192e625ebf087e54f747a66b38f4034431708 (diff) | |
download | FreeBSD-src-60e03ff57430c89402d145108b1ad28dac62c7a0.zip FreeBSD-src-60e03ff57430c89402d145108b1ad28dac62c7a0.tar.gz |
MFC r201284
Multiple IPv6 addresses of the same prefix can be installed on the
same interface. The first address will install the prefix route into
the kernel routing table and that prefix will be marked as on-link.
Without RADIX_MPATH enabled, the other address aliases of the same
prefix will update the prefix reference count but no other routes
will be installed. Consequently the prefixes associated with these
addresses would not be marked as on-link. As such, incoming packets
destined to these address aliases will fail the ND6 on-link check
on input. This patch fixes the above problem by searching the kernel
routing table and try to find an on-link prefix on the given interface.
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r-- | sys/netinet6/nd6.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 0297972..50c273d 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -934,8 +934,28 @@ nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) if (pr->ndpr_ifp != ifp) continue; - if (!(pr->ndpr_stateflags & NDPRF_ONLINK)) - continue; + if (!(pr->ndpr_stateflags & NDPRF_ONLINK)) { + struct rtentry *rt; + rt = rtalloc1((struct sockaddr *)&pr->ndpr_prefix, 0, 0); + if (rt == NULL) + continue; + /* + * This is the case where multiple interfaces + * have the same prefix, but only one is installed + * into the routing table and that prefix entry + * is not the one being examined here. In the case + * where RADIX_MPATH is enabled, multiple route + * entries (of the same rt_key value) will be + * installed because the interface addresses all + * differ. + */ + if (!IN6_ARE_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr, + &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr)) { + RTFREE_LOCKED(rt); + continue; + } + RTFREE_LOCKED(rt); + } if (IN6_ARE_MASKED_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr, &addr->sin6_addr, &pr->ndpr_mask)) |