Widen network epoch coverage in nd6_prefix_onlink() as

in6ifa_ifpforlinklocal() requires the epoch.

Reported by:	bz
Reviewed by:	bz
This commit is contained in:
glebius 2019-11-07 17:00:20 +00:00
parent af3a431a84
commit 2105b345fe

View File

@ -1974,6 +1974,7 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, struct ifaddr *ifa)
int
nd6_prefix_onlink(struct nd_prefix *pr)
{
struct epoch_tracker et;
struct ifaddr *ifa;
struct ifnet *ifp = pr->ndpr_ifp;
struct nd_prefix *opr;
@ -2018,22 +2019,20 @@ nd6_prefix_onlink(struct nd_prefix *pr)
* We prefer link-local addresses as the associated interface address.
*/
/* search for a link-local addr */
NET_EPOCH_ENTER(et);
ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp,
IN6_IFF_NOTREADY | IN6_IFF_ANYCAST);
if (ifa == NULL) {
struct epoch_tracker et;
/* XXX: freebsd does not have ifa_ifwithaf */
NET_EPOCH_ENTER(et);
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family == AF_INET6) {
ifa_ref(ifa);
break;
}
}
NET_EPOCH_EXIT(et);
/* should we care about ia6_flags? */
}
NET_EPOCH_EXIT(et);
if (ifa == NULL) {
/*
* This can still happen, when, for example, we receive an RA