From e570ee385419f97e7ebb5059236d745f587e3306 Mon Sep 17 00:00:00 2001 From: melifaro Date: Mon, 5 Nov 2012 22:54:00 +0000 Subject: Add assertion to enforce 'nat global' locking requierements changed by r241908. Suggested by: adrian, glebius MFC after: 3 days --- sys/netpfil/ipfw/ip_fw_nat.c | 1 + sys/netpfil/ipfw/ip_fw_private.h | 1 + 2 files changed, 2 insertions(+) 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) -- cgit v1.1