[Midnightbsd-cvs] src [8528] trunk/sys/netpfil/ipfw: remove unneeded locks
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Sep 19 09:42:56 EDT 2016
Revision: 8528
http://svnweb.midnightbsd.org/src/?rev=8528
Author: laffer1
Date: 2016-09-19 09:42:56 -0400 (Mon, 19 Sep 2016)
Log Message:
-----------
remove unneeded locks
Modified Paths:
--------------
trunk/sys/netpfil/ipfw/ip_fw_nat.c
trunk/sys/netpfil/ipfw/ip_fw_private.h
Modified: trunk/sys/netpfil/ipfw/ip_fw_nat.c
===================================================================
--- trunk/sys/netpfil/ipfw/ip_fw_nat.c 2016-09-19 13:42:37 UTC (rev 8527)
+++ trunk/sys/netpfil/ipfw/ip_fw_nat.c 2016-09-19 13:42:56 UTC (rev 8528)
@@ -202,6 +202,13 @@
}
}
+/*
+ * ipfw_nat - perform mbuf header translation.
+ *
+ * Note V_layer3_chain has to be locked while calling ipfw_nat() in
+ * 'global' operation mode (t == NULL).
+ *
+ */
static int
ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m)
{
@@ -269,7 +276,7 @@
found = 0;
chain = &V_layer3_chain;
- IPFW_RLOCK(chain);
+ IPFW_RLOCK_ASSERT(chain);
/* Check every nat entry... */
LIST_FOREACH(t, &chain->nat, _next) {
if ((t->mode & PKT_ALIAS_SKIP_GLOBAL) != 0)
@@ -282,7 +289,6 @@
break;
}
}
- IPFW_RUNLOCK(chain);
if (found != 1) {
/* No instance found, return ignore */
args->m = mcl;
Modified: trunk/sys/netpfil/ipfw/ip_fw_private.h
===================================================================
--- trunk/sys/netpfil/ipfw/ip_fw_private.h 2016-09-19 13:42:37 UTC (rev 8527)
+++ trunk/sys/netpfil/ipfw/ip_fw_private.h 2016-09-19 13:42:56 UTC (rev 8528)
@@ -251,6 +251,7 @@
rw_destroy(&(_chain)->uh_lock); \
} while (0)
+#define IPFW_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_RLOCKED)
#define IPFW_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_WLOCKED)
#define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx)
More information about the Midnightbsd-cvs
mailing list