Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/scope6.c
Show First 20 Lines • Show All 460 Lines • ▼ Show 20 Lines | in6_getscope(const struct in6_addr *in6) | ||||
if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) | if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) | ||||
return (in6->s6_addr16[1]); | return (in6->s6_addr16[1]); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Returns scope zone id for the unicast address @in6. | |||||
* | |||||
* Returns 0 for global unicast and loopback addresses. | |||||
* Returns interface index for the link-local addresses. | |||||
*/ | |||||
uint32_t | |||||
in6_get_unicast_scopeid(const struct in6_addr *in6, const struct ifnet *ifp) | |||||
{ | |||||
if (IN6_IS_SCOPE_LINKLOCAL(in6)) | |||||
return (ifp->if_index); | |||||
return (0); | |||||
} | |||||
void | |||||
in6_set_unicast_scopeid(struct in6_addr *in6, uint32_t scopeid) | |||||
{ | |||||
in6->s6_addr16[1] = htons(scopeid & 0xffff); | |||||
} | |||||
/* | |||||
* Return pointer to ifnet structure, corresponding to the zone id of | * Return pointer to ifnet structure, corresponding to the zone id of | ||||
* link-local scope. | * link-local scope. | ||||
*/ | */ | ||||
struct ifnet* | struct ifnet* | ||||
in6_getlinkifnet(uint32_t zoneid) | in6_getlinkifnet(uint32_t zoneid) | ||||
{ | { | ||||
return (ifnet_byindex((u_short)zoneid)); | return (ifnet_byindex((u_short)zoneid)); | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |