From b173c880aa20391adf396c098a510e93c583ec02 Mon Sep 17 00:00:00 2001 From: mlaier Date: Sun, 13 Jun 2004 01:36:31 +0000 Subject: Prepare pf for building with ALTQ: - remove old pfaltq module linkage - move pfaltq_running to pf_ioctl.c It is protected by PF_LOCK() --- sys/contrib/pf/net/pf.c | 2 +- sys/contrib/pf/net/pf_ioctl.c | 54 +++---------------------------------------- sys/contrib/pf/net/pfvar.h | 4 ---- 3 files changed, 4 insertions(+), 56 deletions(-) diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c index 141b431..46f45c8 100644 --- a/sys/contrib/pf/net/pf.c +++ b/sys/contrib/pf/net/pf.c @@ -5835,7 +5835,7 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0) { u_short action, reason = 0, log = 0; struct mbuf *m = *m0; - struct ip6_hdr *h; + struct ip6_hdr *h = NULL; /* make the compiler happy */ struct pf_rule *a = NULL, *r = &pf_default_rule, *tr; struct pf_state *s = NULL; struct pf_ruleset *ruleset = NULL; diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c index e4c0108..bb83ac1 100644 --- a/sys/contrib/pf/net/pf_ioctl.c +++ b/sys/contrib/pf/net/pf_ioctl.c @@ -128,6 +128,9 @@ extern struct timeout pf_expire_to; #endif struct pf_rule pf_default_rule; +#ifdef ALTQ +static int pfaltq_running; +#endif #define TAGID_MAX 50000 TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags); @@ -229,26 +232,12 @@ void init_pf_mutex(void) { mtx_init(&pf_task_mtx, "pf task mtx", NULL, MTX_DEF); -/* - * pf_altq_mtx is initialized at altq_subr.c. - * - * #if defined(ALTQ) && !defined(ALTQ3_COMPAT) - * mtx_init(&pf_altq_mtx, "pf altq mtx", NULL, MTX_DEF); - * #endif - */ } void destroy_pf_mutex(void) { mtx_destroy(&pf_task_mtx); -/* - * pf_altq_mtx is initialized at altq_subr.c. - * - * #if defined(ALTQ) && !defined(ALTQ3_COMPAT) - * mtx_destroy(&pf_altq_mtx); - * #endif - */ } void @@ -1771,16 +1760,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) break; } } -#ifdef __FreeBSD__ - if (error == 0) { - mtx_lock(&pf_altq_mtx); - pfaltq_running = 1; - mtx_unlock(&pf_altq_mtx); - } -#else if (error == 0) pfaltq_running = 1; -#endif splx(s); DPFPRINTF(PF_DEBUG_MISC, ("altq: started\n")); break; @@ -1812,16 +1793,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) error = err; } } -#ifdef __FreeBSD__ - if (error == 0) { - mtx_lock(&pf_altq_mtx); - pfaltq_running = 0; - mtx_unlock(&pf_altq_mtx); - } -#else if (error == 0) pfaltq_running = 0; -#endif splx(s); DPFPRINTF(PF_DEBUG_MISC, ("altq: stopped\n")); break; @@ -2807,16 +2780,8 @@ pf_stopaltq(void) error = err; } } -#ifdef __FreeBSD__ - if (error == 0) { - mtx_lock(&pf_altq_mtx); - pfaltq_running = 0; - mtx_unlock(&pf_altq_mtx); - } -#else if (error == 0) pfaltq_running = 0; -#endif splx(s); } while (0); @@ -3210,11 +3175,6 @@ pf_load(void) destroy_pf_mutex(); return (ENOMEM); } -#ifdef ALTQ - mtx_lock(&pf_altq_mtx); - ++pfaltq_ref; - mtx_unlock(&pf_altq_mtx); -#endif return (0); } @@ -3240,11 +3200,6 @@ pf_unload(void) cleanup_pf_zone(); pf_osfp_cleanup(); destroy_dev(pf_dev); -#ifdef ALTQ - mtx_lock(&pf_altq_mtx); - --pfaltq_ref; - mtx_unlock(&pf_altq_mtx); -#endif destroy_pf_mutex(); return error; } @@ -3278,8 +3233,5 @@ static moduledata_t pf_mod = { DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_DEPEND(pf, pflog, PFLOG_MINVER, PFLOG_PREFVER, PFLOG_MAXVER); MODULE_DEPEND(pf, pfsync, PFSYNC_MINVER, PFSYNC_PREFVER, PFSYNC_MAXVER); -#ifdef ALTQ -MODULE_DEPEND(pf, pfaltq, PFALTQ_MINVER, PFALTQ_PREFVER, PFALTQ_MAXVER); -#endif MODULE_VERSION(pf, PF_MODVER); #endif /* __FreeBSD__ */ diff --git a/sys/contrib/pf/net/pfvar.h b/sys/contrib/pf/net/pfvar.h index 5f71556..9012227 100644 --- a/sys/contrib/pf/net/pfvar.h +++ b/sys/contrib/pf/net/pfvar.h @@ -175,10 +175,6 @@ struct pf_addr_dyn { if(var) uma_zdestroy(var) extern struct mtx pf_task_mtx; -#ifdef ALTQ -extern struct mtx pf_altq_mtx; -extern int pfaltq_ref; -#endif #define PF_ASSERT(h) mtx_assert(&pf_task_mtx, (h)) -- cgit v1.1