Add assertion to enforce 'nat global' locking requierements changed by r241908.

Suggested by:	adrian, glebius
MFC after:	3 days
This commit is contained in:
melifaro 2012-11-05 22:54:00 +00:00
parent 6056a71b0e
commit e570ee3854
2 changed files with 2 additions and 0 deletions

View File

@ -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)

View File

@ -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)