FreeBSD/sys/netinet6/scope6.c
/*
 * Get a scope of the address. Node-local, link-local, site-local or global.
 */
Get a scope of the address.
Get a scope of the address .
int
in6_addrscope(const struct in6_addr *addr)
{
	if (IN6_IS_ADDR_MULTICAST(addr)) {
		if (IPV6_ADDR_MC_SCOPE(addr) == 0x0f)
			return (IPV6_ADDR_SCOPE_GLOBAL);
		return (IPV6_ADDR_MC_SCOPE(addr));
	}
	if (IN6_IS_ADDR_LINKLOCAL(addr) ||
	    IN6_IS_ADDR_LOOPBACK(addr))
		return (IPV6_ADDR_SCOPE_LINKLOCAL);
	if (IN6_IS_ADDR_SITELOCAL(addr))
		return (IPV6_ADDR_SCOPE_SITELOCAL);
	return (IPV6_ADDR_SCOPE_GLOBAL);
}
int in6_addrscope ( const struct in6_addr * addr ) { if ( IN6_IS_ADDR_MULTICAST ( addr ) ) { if ( IPV6_ADDR_MC_SCOPE ( addr ) == 0x0f ) return ( IPV6_ADDR_SCOPE_GLOBAL ) ; return ( IPV6_ADDR_MC_SCOPE ( addr ) ) ; } if ( IN6_IS_ADDR_LINKLOCAL ( addr ) || IN6_IS_ADDR_LOOPBACK ( addr ) ) return ( IPV6_ADDR_SCOPE_LINKLOCAL ) ; if ( IN6_IS_ADDR_SITELOCAL ( addr ) ) return ( IPV6_ADDR_SCOPE_SITELOCAL ) ; return ( IPV6_ADDR_SCOPE_GLOBAL ) ; }
Get a scope of the address.
Get a scope of the address .
/*
		 * Addresses with reserved value F must be treated as
		 * global multicast addresses.
		 */