Index: head/sys/netpfil/ipfw/ip_fw2.c =================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Index: head/sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -47,11 +47,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include /* for ETHERTYPE_IP */ #include +#include #include #include Index: head/sys/netpfil/ipfw/ip_fw_nat.c =================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw_nat.c (working copy) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #define IPFW_INTERNAL /* Access to protected data structures in ip_fw.h. */ @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -496,6 +497,7 @@ ipfw_nat_del(struct sockopt *sopt) static int ipfw_nat_get_cfg(struct sockopt *sopt) { + IPFW_RLOCK_TRACKER; struct ip_fw_chain *chain = &V_layer3_chain; struct cfg_nat *n; struct cfg_redir *r; @@ -556,6 +558,7 @@ retry: static int ipfw_nat_get_log(struct sockopt *sopt) { + IPFW_RLOCK_TRACKER; uint8_t *data; struct cfg_nat *ptr; int i, size; Index: head/sys/netpfil/ipfw/ip_fw_private.h =================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw_private.h (working copy) @@ -227,7 +227,6 @@ struct ip_fw_chain { spinlock_t rwmtx; spinlock_t uh_lock; #else - struct rwlock rwmtx; struct rwlock uh_lock; /* lock for upper half */ #endif uint32_t id; /* ruleset id */ @@ -265,6 +264,7 @@ struct sockopt; /* used by tcp_var.h */ * so the variable and the macros must be here. */ +#if defined( __linux__ ) || defined( _WIN32 ) #define IPFW_LOCK_INIT(_chain) do { \ rw_init(&(_chain)->rwmtx, "IPFW static rules"); \ rw_init(&(_chain)->uh_lock, "IPFW UH lock"); \ @@ -277,7 +277,7 @@ struct sockopt; /* used by tcp_var.h */ #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_TRACKER #define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) #define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) #define IPFW_WLOCK(p) rw_wlock(&(p)->rwmtx) @@ -284,6 +284,20 @@ struct sockopt; /* used by tcp_var.h */ #define IPFW_WUNLOCK(p) rw_wunlock(&(p)->rwmtx) #define IPFW_PF_RLOCK(p) IPFW_RLOCK(p) #define IPFW_PF_RUNLOCK(p) IPFW_RUNLOCK(p) +#else /* FreeBSD */ +#define IPFW_LOCK_INIT(_chain) rw_init(&(_chain)->uh_lock,\ + "IPFW UH lock") +#define IPFW_LOCK_DESTROY(_chain) rw_destroy(&(_chain)->uh_lock) +#define IPFW_RLOCK_ASSERT(_chain) pfil_lock_assert(RA_RLOCKED) +#define IPFW_WLOCK_ASSERT(_chain) pfil_lock_assert(RA_WLOCKED) +#define IPFW_RLOCK_TRACKER struct rm_priotracker _tracker +#define IPFW_RLOCK(p) pfil_rlock(&_tracker) +#define IPFW_RUNLOCK(p) pfil_runlock(&_tracker) +#define IPFW_WLOCK(p) pfil_wlock() +#define IPFW_WUNLOCK(p) pfil_wunlock() +#define IPFW_PF_RLOCK(p) +#define IPFW_PF_RUNLOCK(p) +#endif #define IPFW_UH_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_RLOCKED) #define IPFW_UH_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_WLOCKED) Index: head/sys/netpfil/ipfw/ip_fw_sockopt.c =================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c (working copy) @@ -49,11 +49,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -941,6 +943,7 @@ int ipfw_ctl(struct sockopt *sopt) { #define RULE_MAXSIZE (256*sizeof(u_int32_t)) + IPFW_RLOCK_TRACKER; int error; size_t size, len, valsize; struct ip_fw *buf, *rule; Index: head/sys/netpfil/ipfw/ip_fw_table.c =================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c (revision 260215) +++ head/sys/netpfil/ipfw/ip_fw_table.c (working copy) @@ -52,9 +52,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include /* ip_fw.h requires IFNAMSIZ */ +#include #include #include #include