summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2017-07-24 15:20:46 +0000
committermikeb <mikeb@openbsd.org>2017-07-24 15:20:46 +0000
commit2b4ab26dae98e34459964b7f16f688ccb8e91794 (patch)
tree1eac960442e9e5a955a4ef0623be847a259a1b2b
parentadd MULTIPROCESSOR guards around otherwise unused pieces to satisfy clang (diff)
downloadwireguard-openbsd-2b4ab26dae98e34459964b7f16f688ccb8e91794.tar.xz
wireguard-openbsd-2b4ab26dae98e34459964b7f16f688ccb8e91794.zip
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.
-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);
}