diff options
author | ume <ume@FreeBSD.org> | 2002-04-01 15:15:05 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2002-04-01 15:15:05 +0000 |
commit | 4d5783c847e671999df8399a84dc8df4b40f8c0d (patch) | |
tree | a6da09149fdf488bd31c520e3e9fbe0a1becb729 | |
parent | 215142e44241468e29102960c2b8acedce1a250c (diff) | |
download | FreeBSD-src-4d5783c847e671999df8399a84dc8df4b40f8c0d.zip FreeBSD-src-4d5783c847e671999df8399a84dc8df4b40f8c0d.tar.gz |
In nd6_lookup(), check if rt_llinfo is non-NULL to avoid returning an
entry that has the LLINFO flag but is not a neighbor cache entry.
Obtained from: KAME
MFC after: 1 week
-rw-r--r-- | sys/netinet6/nd6.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index c5b8101..dfdb4e2 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -867,20 +867,25 @@ nd6_lookup(addr6, create, ifp) rt->rt_refcnt--; /* * Validation for the entry. + * Note that the check for rt_llinfo is necessary because a cloned + * route from a parent route that has the L flag (e.g. the default + * route to a p2p interface) may have the flag, too, while the + * destination is not actually a neighbor. * XXX: we can't use rt->rt_ifp to check for the interface, since * it might be the loopback interface if the entry is for our * own address on a non-loopback interface. Instead, we should - * use rt->rt_ifa->ifa_ifp, which would specify the REAL interface. + * use rt->rt_ifa->ifa_ifp, which would specify the REAL + * interface. */ if ((rt->rt_flags & RTF_GATEWAY) || (rt->rt_flags & RTF_LLINFO) == 0 || - rt->rt_gateway->sa_family != AF_LINK || + rt->rt_gateway->sa_family != AF_LINK || rt->rt_llinfo == NULL || (ifp && rt->rt_ifa->ifa_ifp != ifp)) { if (create) { log(LOG_DEBUG, "nd6_lookup: failed to lookup %s (if = %s)\n", ip6_sprintf(addr6), ifp ? if_name(ifp) : "unspec"); /* xxx more logs... kazu */ } - return(0); + return(NULL); } return(rt); } @@ -933,7 +938,7 @@ nd6_is_addr_neighbor(addr, ifp) * Even if the address matches none of our addresses, it might be * in the neighbor cache. */ - if (nd6_lookup(&addr->sin6_addr, 0, ifp)) + if (nd6_lookup(&addr->sin6_addr, 0, ifp) != NULL) return(1); return(0); |