Reapply previous patch to fix build.
PR: 194515
This commit is contained in:
parent
3e32dff52c
commit
8d665c6ba8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276756
@ -1494,7 +1494,7 @@ VNET_DECLARE(struct pf_altqqueue *, pf_altqs_inactive);
|
||||
VNET_DECLARE(struct pf_rulequeue, pf_unlinked_rules);
|
||||
#define V_pf_unlinked_rules VNET(pf_unlinked_rules)
|
||||
|
||||
void pf_initialize(void);
|
||||
void pf_vnet_initialize(void);
|
||||
void pf_mtag_initialize(void);
|
||||
void pf_mtag_cleanup(void);
|
||||
void pf_cleanup(void);
|
||||
@ -1586,7 +1586,7 @@ int pf_match_addr_range(struct pf_addr *, struct pf_addr *,
|
||||
struct pf_addr *, sa_family_t);
|
||||
int pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);
|
||||
|
||||
void pf_normalize_init(void);
|
||||
void pf_vnet_normalize_init(void);
|
||||
void pf_normalize_cleanup(void);
|
||||
int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
|
||||
struct pf_pdesc *);
|
||||
@ -1648,7 +1648,7 @@ MALLOC_DECLARE(PFI_MTYPE);
|
||||
VNET_DECLARE(struct pfi_kif *, pfi_all);
|
||||
#define V_pfi_all VNET(pfi_all)
|
||||
|
||||
void pfi_initialize(void);
|
||||
void pfi_vnet_initialize(void);
|
||||
void pfi_cleanup(void);
|
||||
void pfi_kif_ref(struct pfi_kif *);
|
||||
void pfi_kif_unref(struct pfi_kif *);
|
||||
|
@ -151,6 +151,7 @@ static VNET_DEFINE(struct pf_send_head, pf_sendqueue);
|
||||
#define V_pf_sendqueue VNET(pf_sendqueue)
|
||||
|
||||
static struct mtx pf_sendqueue_mtx;
|
||||
MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF);
|
||||
#define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx)
|
||||
#define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx)
|
||||
|
||||
@ -172,11 +173,15 @@ static VNET_DEFINE(struct task, pf_overloadtask);
|
||||
#define V_pf_overloadtask VNET(pf_overloadtask)
|
||||
|
||||
static struct mtx pf_overloadqueue_mtx;
|
||||
MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx,
|
||||
"pf overload/flush queue", MTX_DEF);
|
||||
#define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx)
|
||||
#define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx)
|
||||
|
||||
VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules);
|
||||
struct mtx pf_unlnkdrules_mtx;
|
||||
MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules",
|
||||
MTX_DEF);
|
||||
|
||||
static VNET_DEFINE(uma_zone_t, pf_sources_z);
|
||||
#define V_pf_sources_z VNET(pf_sources_z)
|
||||
@ -726,7 +731,7 @@ pf_mtag_initialize()
|
||||
|
||||
/* Per-vnet data storage structures initialization. */
|
||||
void
|
||||
pf_initialize()
|
||||
pf_vnet_initialize()
|
||||
{
|
||||
struct pf_keyhash *kh;
|
||||
struct pf_idhash *ih;
|
||||
@ -786,13 +791,9 @@ pf_initialize()
|
||||
STAILQ_INIT(&V_pf_sendqueue);
|
||||
SLIST_INIT(&V_pf_overloadqueue);
|
||||
TASK_INIT(&V_pf_overloadtask, 0, pf_overload_task, curvnet);
|
||||
mtx_init(&pf_sendqueue_mtx, "pf send queue", NULL, MTX_DEF);
|
||||
mtx_init(&pf_overloadqueue_mtx, "pf overload/flush queue", NULL,
|
||||
MTX_DEF);
|
||||
|
||||
/* Unlinked, but may be referenced rules. */
|
||||
TAILQ_INIT(&V_pf_unlinked_rules);
|
||||
mtx_init(&pf_unlnkdrules_mtx, "pf unlinked rules", NULL, MTX_DEF);
|
||||
}
|
||||
|
||||
void
|
||||
@ -835,10 +836,6 @@ pf_cleanup()
|
||||
free(pfse, M_PFTEMP);
|
||||
}
|
||||
|
||||
mtx_destroy(&pf_sendqueue_mtx);
|
||||
mtx_destroy(&pf_overloadqueue_mtx);
|
||||
mtx_destroy(&pf_unlnkdrules_mtx);
|
||||
|
||||
uma_zdestroy(V_pf_sources_z);
|
||||
uma_zdestroy(V_pf_state_z);
|
||||
uma_zdestroy(V_pf_state_key_z);
|
||||
|
@ -102,10 +102,13 @@ MALLOC_DEFINE(PFI_MTYPE, "pf_ifnet", "pf(4) interface database");
|
||||
LIST_HEAD(pfi_list, pfi_kif);
|
||||
static VNET_DEFINE(struct pfi_list, pfi_unlinked_kifs);
|
||||
#define V_pfi_unlinked_kifs VNET(pfi_unlinked_kifs)
|
||||
|
||||
static struct mtx pfi_unlnkdkifs_mtx;
|
||||
MTX_SYSINIT(pfi_unlnkdkifs_mtx, &pfi_unlnkdkifs_mtx, "pf unlinked interfaces",
|
||||
MTX_DEF);
|
||||
|
||||
void
|
||||
pfi_initialize(void)
|
||||
pfi_vnet_initialize(void)
|
||||
{
|
||||
struct ifg_group *ifg;
|
||||
struct ifnet *ifp;
|
||||
@ -169,8 +172,6 @@ pfi_cleanup(void)
|
||||
free(p, PFI_MTYPE);
|
||||
}
|
||||
|
||||
mtx_destroy(&pfi_unlnkdkifs_mtx);
|
||||
|
||||
free(V_pfi_buffer, PFI_MTYPE);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <altq/altq.h>
|
||||
#endif
|
||||
|
||||
static int pfattach(void);
|
||||
static int pf_vnet_init(void);
|
||||
static struct pf_pool *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t,
|
||||
u_int8_t, u_int8_t, u_int8_t);
|
||||
|
||||
@ -204,17 +204,20 @@ pfsync_defer_t *pfsync_defer_ptr = NULL;
|
||||
pflog_packet_t *pflog_packet_ptr = NULL;
|
||||
|
||||
static int
|
||||
pfattach(void)
|
||||
pf_vnet_init(void)
|
||||
{
|
||||
u_int32_t *my_timeout = V_pf_default_rule.timeout;
|
||||
int error;
|
||||
|
||||
if (IS_DEFAULT_VNET(curvnet))
|
||||
pf_mtag_initialize();
|
||||
pf_initialize();
|
||||
TAILQ_INIT(&V_pf_tags);
|
||||
TAILQ_INIT(&V_pf_qids);
|
||||
|
||||
pf_vnet_initialize();
|
||||
pfr_initialize();
|
||||
pfi_initialize();
|
||||
pf_normalize_init();
|
||||
pfi_vnet_initialize();
|
||||
pf_vnet_normalize_init();
|
||||
|
||||
V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT;
|
||||
V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT;
|
||||
@ -3717,27 +3720,11 @@ dehook_pf(void)
|
||||
static int
|
||||
pf_load(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
VNET_ITERATOR_DECL(vnet_iter);
|
||||
|
||||
VNET_LIST_RLOCK();
|
||||
VNET_FOREACH(vnet_iter) {
|
||||
CURVNET_SET(vnet_iter);
|
||||
V_pf_pfil_hooked = 0;
|
||||
V_pf_end_threads = 0;
|
||||
TAILQ_INIT(&V_pf_tags);
|
||||
TAILQ_INIT(&V_pf_qids);
|
||||
CURVNET_RESTORE();
|
||||
}
|
||||
VNET_LIST_RUNLOCK();
|
||||
|
||||
rw_init(&pf_rules_lock, "pf rulesets");
|
||||
sx_init(&pf_ioctl_lock, "pf ioctl");
|
||||
|
||||
pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME);
|
||||
if ((error = pfattach()) != 0)
|
||||
return (error);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -3810,6 +3797,5 @@ static moduledata_t pf_mod = {
|
||||
|
||||
DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST);
|
||||
MODULE_VERSION(pf, PF_MODVER);
|
||||
|
||||
VNET_SYSINIT(vnet_pf_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
|
||||
vnet_pf_init, NULL);
|
||||
VNET_SYSINIT(pf_vnet_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
|
||||
pf_vnet_init, NULL);
|
||||
|
@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "opt_pf.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -92,6 +93,7 @@ struct pf_fragment {
|
||||
};
|
||||
|
||||
static struct mtx pf_frag_mtx;
|
||||
MTX_SYSINIT(pf_frag_mtx, &pf_frag_mtx, "pf fragments", MTX_DEF);
|
||||
#define PF_FRAG_LOCK() mtx_lock(&pf_frag_mtx)
|
||||
#define PF_FRAG_UNLOCK() mtx_unlock(&pf_frag_mtx)
|
||||
#define PF_FRAG_ASSERT() mtx_assert(&pf_frag_mtx, MA_OWNED)
|
||||
@ -146,7 +148,7 @@ static void pf_scrub_ip6(struct mbuf **, u_int8_t);
|
||||
} while(0)
|
||||
|
||||
void
|
||||
pf_normalize_init(void)
|
||||
pf_vnet_normalize_init(void)
|
||||
{
|
||||
|
||||
V_pf_frag_z = uma_zcreate("pf frags", sizeof(struct pf_fragment),
|
||||
@ -176,8 +178,6 @@ pf_normalize_cleanup(void)
|
||||
uma_zdestroy(V_pf_state_scrub_z);
|
||||
uma_zdestroy(V_pf_frent_z);
|
||||
uma_zdestroy(V_pf_frag_z);
|
||||
|
||||
mtx_destroy(&pf_frag_mtx);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user