summaryrefslogtreecommitdiffstats
path: root/sys/netpfil
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2012-11-05 22:54:00 +0000
committermelifaro <melifaro@FreeBSD.org>2012-11-05 22:54:00 +0000
commite570ee385419f97e7ebb5059236d745f587e3306 (patch)
treef070bb56bf2f45e87a1a4f6d54a1c28e64d71a36 /sys/netpfil
parent6056a71b0eb3028cb5da432f3ef0f5a5545e8e65 (diff)
downloadFreeBSD-src-e570ee385419f97e7ebb5059236d745f587e3306.zip
FreeBSD-src-e570ee385419f97e7ebb5059236d745f587e3306.tar.gz
Add assertion to enforce 'nat global' locking requierements changed by r241908.
Suggested by: adrian, glebius MFC after: 3 days
Diffstat (limited to 'sys/netpfil')
-rw-r--r--sys/netpfil/ipfw/ip_fw_nat.c1
-rw-r--r--sys/netpfil/ipfw/ip_fw_private.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c
index d387ddb..84852db 100644
--- a/sys/netpfil/ipfw/ip_fw_nat.c
+++ b/sys/netpfil/ipfw/ip_fw_nat.c
@@ -276,6 +276,7 @@ ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m)
found = 0;
chain = &V_layer3_chain;
+ IPFW_RLOCK_ASSERT(chain);
/* Check every nat entry... */
LIST_FOREACH(t, &chain->nat, _next) {
if ((t->mode & PKT_ALIAS_SKIP_GLOBAL) != 0)
diff --git a/sys/netpfil/ipfw/ip_fw_private.h b/sys/netpfil/ipfw/ip_fw_private.h
index fb13a72..7a3123b 100644
--- a/sys/netpfil/ipfw/ip_fw_private.h
+++ b/sys/netpfil/ipfw/ip_fw_private.h
@@ -251,6 +251,7 @@ struct sockopt; /* used by tcp_var.h */
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)
OpenPOWER on IntegriCloud