FreeBSD/sys/netinet6/in6.c
/*
 * Return 1 if an internet address is for the local host and configured
 * on one of its interfaces.
 */
Return 1 if an internet address is for the local host and configured
on one of its interfaces.
Return 1 if an internet address is for the local host and configured on one of its interfaces .
int
in6_localip(struct in6_addr *in6)
{
	struct rm_priotracker in6_ifa_tracker;
	struct in6_ifaddr *ia;
	IN6_IFADDR_RLOCK(&in6_ifa_tracker);
	LIST_FOREACH(ia, IN6ADDR_HASH(in6), ia6_hash) {
		if (IN6_ARE_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr)) {
			IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
			return (1);
		}
	}
	IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
	return (0);
}
int in6_localip ( struct in6_addr * in6 ) { struct rm_priotracker in6_ifa_tracker ; struct in6_ifaddr * ia ; IN6_IFADDR_RLOCK ( & in6_ifa_tracker ) ; LIST_FOREACH ( ia , IN6ADDR_HASH ( in6 ) , ia6_hash ) { if ( IN6_ARE_ADDR_EQUAL ( in6 , & ia -> ia_addr . sin6_addr ) ) { IN6_IFADDR_RUNLOCK ( & in6_ifa_tracker ) ; return ( 1 ) ; } } IN6_IFADDR_RUNLOCK ( & in6_ifa_tracker ) ; return ( 0 ) ; }
Return 1 if an internet address is for the local host and configured
 on one of its interfaces.
Return 1 if an internet address is for the local host and configured on one of its interfaces .