FreeBSD/sys/netinet6/in6.c
struct in6_ifaddr *
in6ifa_ifpwithaddr(struct ifnet *ifp, const struct in6_addr *addr)
{
	struct ifaddr *ifa;

	IF_ADDR_RLOCK(ifp);
	TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
		if (ifa->ifa_addr->sa_family != AF_INET6)
			continue;
		if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) {
			ifa_ref(ifa);
			break;
		}
	}
	IF_ADDR_RUNLOCK(ifp);

	return ((struct in6_ifaddr *)ifa);
}
/*
 * find the internet address corresponding to a given interface and address.
 * ifaddr is returned referenced.
 */
find the internet address corresponding to a given interface and address.
ifaddr is returned referenced.
find the internet address corresponding to a given interface and address . ifaddr is returned referenced .
struct in6_ifaddr *
in6ifa_ifpwithaddr(struct ifnet *ifp, const struct in6_addr *addr)
{
	struct ifaddr *ifa;
	IF_ADDR_RLOCK(ifp);
	TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
		if (ifa->ifa_addr->sa_family != AF_INET6)
			continue;
		if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) {
			ifa_ref(ifa);
			break;
		}
	}
	IF_ADDR_RUNLOCK(ifp);
	return ((struct in6_ifaddr *)ifa);
}
struct in6_ifaddr * in6ifa_ifpwithaddr ( struct ifnet * ifp , const struct in6_addr * addr ) { struct ifaddr * ifa ; IF_ADDR_RLOCK ( ifp ) ; TAILQ_FOREACH ( ifa , & ifp -> if_addrhead , ifa_link ) { if ( ifa -> ifa_addr -> sa_family != AF_INET6 ) continue ; if ( IN6_ARE_ADDR_EQUAL ( addr , IFA_IN6 ( ifa ) ) ) { ifa_ref ( ifa ) ; break ; } } IF_ADDR_RUNLOCK ( ifp ) ; return ( ( struct in6_ifaddr * ) ifa ) ; }
find the internet address corresponding to a given interface and address.
find the internet address corresponding to a given interface and address .