Author: glebius
Date: Mon Oct 14 16:37:41 2019
New Revision: 353495
URL: https://svnweb.freebsd.org/changeset/base/353495

Log:
  Use epoch(9) directly instead of obsoleted KPI.

Modified:
  head/sys/netpfil/ipfw/ip_fw_nat.c
  head/sys/netpfil/ipfw/nptv6/nptv6.c

Modified: head/sys/netpfil/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_nat.c   Mon Oct 14 16:37:00 2019        
(r353494)
+++ head/sys/netpfil/ipfw/ip_fw_nat.c   Mon Oct 14 16:37:41 2019        
(r353495)
@@ -114,10 +114,12 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp)
        IPFW_UH_WLOCK(chain);
        /* Check every nat entry... */
        LIST_FOREACH(ptr, &chain->nat, _next) {
+               struct epoch_tracker et;
+
                /* ...using nic 'ifp->if_xname' as dynamic alias address. */
                if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) != 0)
                        continue;
-               if_addr_rlock(ifp);
+               NET_EPOCH_ENTER(et);
                CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
                        if (ifa->ifa_addr == NULL)
                                continue;
@@ -129,7 +131,7 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp)
                        LibAliasSetAddress(ptr->lib, ptr->ip);
                        IPFW_WUNLOCK(chain);
                }
-               if_addr_runlock(ifp);
+               NET_EPOCH_EXIT(et);
        }
        IPFW_UH_WUNLOCK(chain);
 }

Modified: head/sys/netpfil/ipfw/nptv6/nptv6.c
==============================================================================
--- head/sys/netpfil/ipfw/nptv6/nptv6.c Mon Oct 14 16:37:00 2019        
(r353494)
+++ head/sys/netpfil/ipfw/nptv6/nptv6.c Mon Oct 14 16:37:41 2019        
(r353495)
@@ -534,6 +534,7 @@ static void
 nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6_cfg *cfg,
     struct ifnet *ifp)
 {
+       struct epoch_tracker et;
        struct ifaddr *ifa;
        struct in6_ifaddr *ia;
 
@@ -545,7 +546,7 @@ nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6
                if (ifp == NULL)
                        return;
        }
-       if_addr_rlock(ifp);
+       NET_EPOCH_ENTER(et);
        CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
                if (ifa->ifa_addr->sa_family != AF_INET6)
                        continue;
@@ -558,7 +559,7 @@ nptv6_find_prefix(struct ip_fw_chain *ch, struct nptv6
                nptv6_set_external(cfg, &ia->ia_addr.sin6_addr);
                break;
        }
-       if_addr_runlock(ifp);
+       NET_EPOCH_EXIT(et);
        if_rele(ifp);
 }
 
_______________________________________________
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