summaryrefslogtreecommitdiff
path: root/sys/altq/altq_subr.c
diff options
context:
space:
mode:
authorKenjiro Cho <kjc@cvs.openbsd.org>2002-11-26 03:44:54 +0000
committerKenjiro Cho <kjc@cvs.openbsd.org>2002-11-26 03:44:54 +0000
commitdc367dedac6a4ec8a7f45b42f980a09fbb0b273e (patch)
tree4e6a475e03374726d910b1fb01cd1c37239e265e /sys/altq/altq_subr.c
parentf55b6e518fa1b9acbff743f75de0827f9eb89de8 (diff)
fix "pfctl -Fq".
after altq gets flushed, altq forgot that it was enabled since altq is actually detached with an empty ruleset. so, add a variable, pfaltq_running, to remember the running state and re-enable altq when a new ruleset is loaded. noticed, tested, and oked by henning@
Diffstat (limited to 'sys/altq/altq_subr.c')
-rw-r--r--sys/altq/altq_subr.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/altq/altq_subr.c b/sys/altq/altq_subr.c
index f6fa7f72ae9..96556e6c41e 100644
--- a/sys/altq/altq_subr.c
+++ b/sys/altq/altq_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_subr.c,v 1.10 2002/11/26 01:03:34 henning Exp $ */
+/* $OpenBSD: altq_subr.c,v 1.11 2002/11/26 03:44:53 kjc Exp $ */
/* $KAME: altq_subr.c,v 1.11 2002/01/11 08:11:49 kjc Exp $ */
/*
@@ -107,6 +107,8 @@ int (*altq_input)(struct mbuf *, int) = NULL;
static int tbr_timer = 0; /* token bucket regulator timer */
static struct callout tbr_callout = CALLOUT_INITIALIZER;
+int pfaltq_running; /* keep track of running state */
+
/*
* alternate queueing support routines
*/
@@ -449,9 +451,16 @@ altq_pfattach(struct pf_altq *a)
error = EINVAL;
}
+ ifp = ifunit(a->ifname);
+
+ /* if the state is running, enable altq */
+ if (error == 0 && pfaltq_running &&
+ ifp != NULL && ifp->if_snd.altq_type != ALTQT_NONE &&
+ !ALTQ_IS_ENABLED(&ifp->if_snd))
+ error = altq_enable(&ifp->if_snd);
+
/* if altq is already enabled, reset set tokenbucket regulator */
- if (error == 0 && (ifp = ifunit(a->ifname)) != NULL &&
- ALTQ_IS_ENABLED(&ifp->if_snd)) {
+ if (error == 0 && ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) {
tb.rate = a->ifbandwidth;
tb.depth = a->tbrsize;
s = splimp();