Adjust the PF_ASSERT() macro to what we usually use in the network stack:
PF_LOCK_ASSERT() and PF_UNLOCK_ASSERT(). MFC after: 3 days
This commit is contained in:
parent
c8eeb97178
commit
232ec0c97d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226535
@ -2143,7 +2143,7 @@ pfsync_sendout(void)
|
||||
int q, count = 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_NET);
|
||||
#endif
|
||||
@ -2378,7 +2378,7 @@ pfsync_insert_state(struct pf_state *st)
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
@ -2430,7 +2430,7 @@ pfsync_defer(struct pf_state *st, struct mbuf *m)
|
||||
struct pfsync_deferral *pd;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
@ -2477,7 +2477,7 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop)
|
||||
int s;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
@ -2560,7 +2560,7 @@ pfsync_update_state(struct pf_state *st)
|
||||
int sync = 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
@ -2710,7 +2710,7 @@ pfsync_delete_state(struct pf_state *st)
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
@ -2771,7 +2771,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname)
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#else
|
||||
splassert(IPL_SOFTNET);
|
||||
#endif
|
||||
|
@ -4259,7 +4259,7 @@ hook_pf(void)
|
||||
struct pfil_head *pfh_inet6;
|
||||
#endif
|
||||
|
||||
PF_ASSERT(MA_NOTOWNED);
|
||||
PF_UNLOCK_ASSERT();
|
||||
|
||||
if (V_pf_pfil_hooked)
|
||||
return (0);
|
||||
@ -4300,7 +4300,7 @@ dehook_pf(void)
|
||||
struct pfil_head *pfh_inet6;
|
||||
#endif
|
||||
|
||||
PF_ASSERT(MA_NOTOWNED);
|
||||
PF_UNLOCK_ASSERT();
|
||||
|
||||
if (V_pf_pfil_hooked == 0)
|
||||
return (0);
|
||||
|
@ -906,7 +906,7 @@ pfr_lookup_addr(struct pfr_ktable *kt, struct pfr_addr *ad, int exact)
|
||||
pfr_prepare_network(&mask, ad->pfra_af, ad->pfra_net);
|
||||
s = splsoftnet(); /* rn_lookup makes use of globals */
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#endif
|
||||
ke = (struct pfr_kentry *)rn_lookup(&sa, &mask, head);
|
||||
splx(s);
|
||||
@ -1127,7 +1127,7 @@ pfr_route_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)
|
||||
|
||||
s = splsoftnet();
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#endif
|
||||
if (KENTRY_NETWORK(ke)) {
|
||||
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
|
||||
@ -1166,7 +1166,7 @@ pfr_unroute_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)
|
||||
|
||||
s = splsoftnet();
|
||||
#ifdef __FreeBSD__
|
||||
PF_ASSERT(MA_OWNED);
|
||||
PF_LOCK_ASSERT();
|
||||
#endif
|
||||
if (KENTRY_NETWORK(ke)) {
|
||||
pfr_prepare_network(&mask, ke->pfrke_af, ke->pfrke_net);
|
||||
|
@ -240,18 +240,20 @@ struct pfi_dynaddr {
|
||||
VNET_DECLARE(struct mtx, pf_task_mtx);
|
||||
#define V_pf_task_mtx VNET(pf_task_mtx)
|
||||
|
||||
#define PF_ASSERT(h) mtx_assert(&V_pf_task_mtx, (h))
|
||||
#define PF_LOCK_ASSERT() mtx_assert(&V_pf_task_mtx, MA_OWNED)
|
||||
#define PF_UNLOCK_ASSERT() mtx_assert(&V_pf_task_mtx, MA_NOTOWNED)
|
||||
|
||||
#define PF_LOCK() do { \
|
||||
PF_ASSERT(MA_NOTOWNED); \
|
||||
PF_UNLOCK_ASSERT(); \
|
||||
mtx_lock(&V_pf_task_mtx); \
|
||||
} while(0)
|
||||
#define PF_UNLOCK() do { \
|
||||
PF_ASSERT(MA_OWNED); \
|
||||
PF_LOCK_ASSERT(); \
|
||||
mtx_unlock(&V_pf_task_mtx); \
|
||||
} while(0)
|
||||
#else
|
||||
#define PF_ASSERT(h)
|
||||
#define PF_LOCK_ASSERT()
|
||||
#define PF_UNLOCK_ASSERT()
|
||||
#define PF_LOCK()
|
||||
#define PF_UNLOCK()
|
||||
#endif /* __FreeBSD__ */
|
||||
|
Loading…
Reference in New Issue
Block a user