Author: glebius
Date: Thu Nov  7 17:00:20 2019
New Revision: 354448
URL: https://svnweb.freebsd.org/changeset/base/354448

Log:
  Widen network epoch coverage in nd6_prefix_onlink() as
  in6ifa_ifpforlinklocal() requires the epoch.
  
  Reported by:  bz
  Reviewed by:  bz

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==============================================================================
--- head/sys/netinet6/nd6_rtr.c Thu Nov  7 15:51:44 2019        (r354447)
+++ head/sys/netinet6/nd6_rtr.c Thu Nov  7 17:00:20 2019        (r354448)
@@ -1974,6 +1974,7 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru
 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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to