summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-24 15:20:47 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-24 15:20:47 +0000
commitdf693c2bd749b3b6410e3a21414035c9f6a52da9 (patch)
tree920c079cb64b3d9abaa2723208d617926d1b20b3 /sys/net
parent5104e405574ca318ebb802a42aee96b529aba42b (diff)
Don't attempt to deactivate a class that doesn't have any packets in it
Classes are considered "active" when they have packets assigned to them. Active classes are tracked on various lists and during the purge operation must be dissociated from them. During factoring out of the HFSC internal FIFO operations, the check for whether the class is empty got lost. Issue reported and fix tested by abieber@ and myself.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/hfsc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/hfsc.c b/sys/net/hfsc.c
index 6f9c9edf4ff..410bea733c6 100644
--- a/sys/net/hfsc.c
+++ b/sys/net/hfsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hfsc.c,v 1.43 2017/07/19 13:41:20 mikeb Exp $ */
+/* $OpenBSD: hfsc.c,v 1.44 2017/07/24 15:20:46 mikeb Exp $ */
/*
* Copyright (c) 2012-2013 Henning Brauer <henning@openbsd.org>
@@ -961,7 +961,14 @@ hfsc_deferred(void *arg)
void
hfsc_cl_purge(struct hfsc_if *hif, struct hfsc_class *cl, struct mbuf_list *ml)
{
- hfsc_class_purge(cl, ml);
+ struct mbuf_list ml2 = MBUF_LIST_INITIALIZER();
+
+ hfsc_class_purge(cl, &ml2);
+ if (ml_empty(&ml2))
+ return;
+
+ ml_enlist(ml, &ml2);
+
hfsc_update_vf(cl, 0, 0); /* remove cl from the actlist */
hfsc_set_passive(hif, cl);
}