| version 1.146, 2013/12/17 20:25:00 |
version 1.147, 2014/01/15 10:25:04 |
| Line 818 nd6_purge(struct ifnet *ifp) |
|
| Line 818 nd6_purge(struct ifnet *ifp) |
|
| } |
} |
| } |
} |
| |
|
| struct rtentry * |
static struct rtentry * |
| nd6_lookup(const struct in6_addr *addr6, int create, struct ifnet *ifp) |
nd6_lookup1(const struct in6_addr *addr6, int create, struct ifnet *ifp, |
| |
int cloning) |
| { |
{ |
| struct rtentry *rt; |
struct rtentry *rt; |
| struct sockaddr_in6 sin6; |
struct sockaddr_in6 sin6; |
| Line 883 nd6_lookup(const struct in6_addr *addr6, |
|
| Line 884 nd6_lookup(const struct in6_addr *addr6, |
|
| } else |
} else |
| return NULL; |
return NULL; |
| rt->rt_refcnt--; |
rt->rt_refcnt--; |
| |
|
| |
/* |
| |
* Check for a cloning route to match the address. |
| |
* This should only be set from in6_is_addr_neighbor so we avoid |
| |
* a potentially expensive second call to rtalloc1. |
| |
*/ |
| |
if (cloning && |
| |
rt->rt_flags & (RTF_CLONING | RTF_CLONED) && |
| |
(rt->rt_ifp == ifp |
| |
#if NBRIDGE > 0 |
| |
|| SAME_BRIDGE(rt->rt_ifp->if_bridgeport, ifp->if_bridgeport) |
| |
#endif |
| |
#if NCARP > 0 |
| |
|| (ifp->if_type == IFT_CARP && rt->rt_ifp == ifp->if_carpdev) || |
| |
(rt->rt_ifp->if_type == IFT_CARP && rt->rt_ifp->if_carpdev == ifp)|| |
| |
(ifp->if_type == IFT_CARP && rt->rt_ifp->if_type == IFT_CARP && |
| |
rt->rt_ifp->if_carpdev == ifp->if_carpdev) |
| |
#endif |
| |
)) |
| |
return rt; |
| |
|
| /* |
/* |
| * Validation for the entry. |
* Validation for the entry. |
| * Note that the check for rt_llinfo is necessary because a cloned |
* Note that the check for rt_llinfo is necessary because a cloned |
| Line 913 nd6_lookup(const struct in6_addr *addr6, |
|
| Line 935 nd6_lookup(const struct in6_addr *addr6, |
|
| return rt; |
return rt; |
| } |
} |
| |
|
| |
struct rtentry * |
| |
nd6_lookup(const struct in6_addr *addr6, int create, struct ifnet *ifp) |
| |
{ |
| |
|
| |
return nd6_lookup1(addr6, create, ifp, 0); |
| |
} |
| |
|
| /* |
/* |
| * Detect if a given IPv6 address identifies a neighbor on a given link. |
* Detect if a given IPv6 address identifies a neighbor on a given link. |
| * XXX: should take care of the destination of a p2p link? |
* XXX: should take care of the destination of a p2p link? |
| Line 973 nd6_is_addr_neighbor(const struct sockad |
|
| Line 1002 nd6_is_addr_neighbor(const struct sockad |
|
| } |
} |
| |
|
| /* |
/* |
| * Even if the address matches none of our addresses, it might be |
* Even if the address matches none of our addresses, it might match |
| * in the neighbor cache. |
* a cloning route or be in the neighbor cache. |
| */ |
*/ |
| if (nd6_lookup(&addr->sin6_addr, 0, ifp) != NULL) |
if (nd6_lookup1(&addr->sin6_addr, 0, ifp, 1) != NULL) |
| return 1; |
return 1; |
| |
|
| return 0; |
return 0; |