summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/altq/altq_subr.c15
-rw-r--r--sys/altq/altq_var.h4
-rw-r--r--sys/net/pf_ioctl.c6
3 files changed, 20 insertions, 5 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();
diff --git a/sys/altq/altq_var.h b/sys/altq/altq_var.h
index f5e6a42b0fc..30fa5357000 100644
--- a/sys/altq/altq_var.h
+++ b/sys/altq/altq_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_var.h,v 1.7 2002/10/11 09:30:30 kjc Exp $ */
+/* $OpenBSD: altq_var.h,v 1.8 2002/11/26 03:44:53 kjc Exp $ */
/* $KAME: altq_var.h,v 1.8 2001/02/09 09:44:41 kjc Exp $ */
/*
@@ -235,6 +235,8 @@ typedef void (timeout_t)(void *);
/* define a macro to check pf/altq until the transition is complete */
#define PFALTQ_IS_ACTIVE() (!TAILQ_EMPTY(pf_altqs_active))
+extern int pfaltq_running;
+
struct ifnet; struct mbuf; struct flowinfo;
struct pf_altq; struct pf_qstats;
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index a58da9b12df..94b467816b3 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.18 2002/11/23 09:37:02 deraadt Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.19 2002/11/26 03:44:53 kjc Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1915,6 +1915,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
break;
}
}
+ if (error == 0)
+ pfaltq_running = 1;
splx(s);
DPFPRINTF(PF_DEBUG_MISC, ("altq: started\n"));
break;
@@ -1946,6 +1948,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
error = err;
}
}
+ if (error == 0)
+ pfaltq_running = 0;
splx(s);
DPFPRINTF(PF_DEBUG_MISC, ("altq: stopped\n"));
break;