Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 2014 16:50:42 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260548 - head/sys/netpfil/ipfw
Message-ID:  <201401111650.s0BGoghA049380@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Sat Jan 11 16:50:41 2014
New Revision: 260548
URL: http://svnweb.freebsd.org/changeset/base/260548

Log:
  We don't need chain write lock since we're not modifying its contents.
  LibAliasSetAddress() uses its own mutex to serialize changes.
  
  While here, convert ifp->if_xname access to if_name() function.
  
  MFC after:	2 weeks
  Sponsored by:	Yandex LLC

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

Modified: head/sys/netpfil/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_nat.c	Sat Jan 11 16:37:20 2014	(r260547)
+++ head/sys/netpfil/ipfw/ip_fw_nat.c	Sat Jan 11 16:50:41 2014	(r260548)
@@ -67,11 +67,11 @@ ifaddr_change(void *arg __unused, struct
 	KASSERT(curvnet == ifp->if_vnet,
 	    ("curvnet(%p) differs from iface vnet(%p)", curvnet, ifp->if_vnet));
 	chain = &V_layer3_chain;
-	IPFW_WLOCK(chain);
+	IPFW_RLOCK(chain);
 	/* Check every nat entry... */
 	LIST_FOREACH(ptr, &chain->nat, _next) {
 		/* ...using nic 'ifp->if_xname' as dynamic alias address. */
-		if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) != 0)
+		if (strncmp(ptr->if_name, if_name(ifp), IF_NAMESIZE) != 0)
 			continue;
 		if_addr_rlock(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -85,7 +85,7 @@ ifaddr_change(void *arg __unused, struct
 		}
 		if_addr_runlock(ifp);
 	}
-	IPFW_WUNLOCK(chain);
+	IPFW_RUNLOCK(chain);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401111650.s0BGoghA049380>