Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6.c
Show First 20 Lines • Show All 1,915 Lines • ▼ Show 20 Lines | if (dst_scope == in6_addrscope(IFA_IN6(ifa))) { | ||||
if (tlen > blen) { | if (tlen > blen) { | ||||
blen = tlen; | blen = tlen; | ||||
besta = (struct in6_ifaddr *)ifa; | besta = (struct in6_ifaddr *)ifa; | ||||
} | } | ||||
} else | } else | ||||
besta = (struct in6_ifaddr *)ifa; | besta = (struct in6_ifaddr *)ifa; | ||||
} | } | ||||
} | } | ||||
if (besta) { | if (besta) | ||||
ifa_ref(&besta->ia_ifa); | |||||
return (besta); | return (besta); | ||||
} | |||||
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { | CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { | ||||
if (ifa->ifa_addr->sa_family != AF_INET6) | if (ifa->ifa_addr->sa_family != AF_INET6) | ||||
continue; | continue; | ||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) | if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) | ||||
continue; /* XXX: is there any case to allow anycast? */ | continue; /* XXX: is there any case to allow anycast? */ | ||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) | if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_NOTREADY) | ||||
continue; /* don't use this interface */ | continue; /* don't use this interface */ | ||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) | if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DETACHED) | ||||
continue; | continue; | ||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { | if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DEPRECATED) { | ||||
if (V_ip6_use_deprecated) | if (V_ip6_use_deprecated) | ||||
dep[1] = (struct in6_ifaddr *)ifa; | dep[1] = (struct in6_ifaddr *)ifa; | ||||
continue; | continue; | ||||
} | } | ||||
if (ifa != NULL) | |||||
ifa_ref(ifa); | |||||
return (struct in6_ifaddr *)ifa; | return (struct in6_ifaddr *)ifa; | ||||
} | } | ||||
/* use the last-resort values, that are, deprecated addresses */ | /* use the last-resort values, that are, deprecated addresses */ | ||||
if (dep[0]) { | if (dep[0]) | ||||
ifa_ref((struct ifaddr *)dep[0]); | |||||
return dep[0]; | return dep[0]; | ||||
} | if (dep[1]) | ||||
if (dep[1]) { | |||||
ifa_ref((struct ifaddr *)dep[1]); | |||||
return dep[1]; | return dep[1]; | ||||
} | |||||
return NULL; | return NULL; | ||||
} | } | ||||
/* | /* | ||||
* perform DAD when interface becomes IFF_UP. | * perform DAD when interface becomes IFF_UP. | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 635 Lines • Show Last 20 Lines |