FreeBSD/sys/netinet/ip_carp.c
/*
 * Returns ifa in case it's a carp address and it is MASTER, or if the address
 * matches and is not a carp address.  Returns NULL otherwise.
 */
Returns ifa in case it's a carp address and it is MASTER, or if the address
matches and is not a carp address.  Returns NULL otherwise.
Returns ifa in case it ' s a carp address and it is MASTER or if the address matches and is not a carp address . Returns NULL otherwise .
struct ifaddr *
carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr)
{
	struct ifaddr *ifa;
	ifa = NULL;
	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(taddr, IFA_IN6(ifa)))
			continue;
		if (ifa->ifa_carp && ifa->ifa_carp->sc_state != MASTER)
			ifa = NULL;
		else
			ifa_ref(ifa);
		break;
	}
	IF_ADDR_RUNLOCK(ifp);
	return (ifa);
}
struct ifaddr * carp_iamatch6 ( struct ifnet * ifp , struct in6_addr * taddr ) { struct ifaddr * ifa ; ifa = NULL ; 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 ( taddr , IFA_IN6 ( ifa ) ) ) continue ; if ( ifa -> ifa_carp && ifa -> ifa_carp -> sc_state != MASTER ) ifa = NULL ; else ifa_ref ( ifa ) ; break ; } IF_ADDR_RUNLOCK ( ifp ) ; return ( ifa ) ; }
Returns ifa in case it's a carp address and it is MASTER, or if the address
 matches and is not a carp address.
Returns ifa in case it ' s a carp address and it is MASTER or if the address matches and is not a carp address .