FreeBSD/sys/netinet6/nd6.c
/*
 * Detect if a given IPv6 address identifies a neighbor on a given link.
 * XXX: should take care of the destination of a p2p link?
 */
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 .
int
nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
{
	struct llentry *lle;
	int rc = 0;
	IF_AFDATA_UNLOCK_ASSERT(ifp);
	if (nd6_is_new_addr_neighbor(addr, ifp))
		return (1);
	IF_AFDATA_RLOCK(ifp);
	if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) {
		LLE_RUNLOCK(lle);
		rc = 1;
	}
	IF_AFDATA_RUNLOCK(ifp);
	return (rc);
}
int nd6_is_addr_neighbor ( const struct sockaddr_in6 * addr , struct ifnet * ifp ) { struct llentry * lle ; int rc = 0 ; IF_AFDATA_UNLOCK_ASSERT ( ifp ) ; if ( nd6_is_new_addr_neighbor ( addr , ifp ) ) return ( 1 ) ; IF_AFDATA_RLOCK ( ifp ) ; if ( ( lle = nd6_lookup ( & addr -> sin6_addr , 0 , ifp ) ) != NULL ) { LLE_RUNLOCK ( lle ) ; rc = 1 ; } IF_AFDATA_RUNLOCK ( ifp ) ; return ( rc ) ; }
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 .
/*
	 * Even if the address matches none of our addresses, it might be
	 * in the neighbor cache.
	 */