summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-19 12:51:32 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-19 12:51:32 +0000
commit5c19c20296730b291c1591907f0230de60c5b9d3 (patch)
treefa475be14120668b462db4d5cb1710d1bdbb2dd8 /sys
parenta98649ea9a316bae378f0491bc7c03ff5266248b (diff)
Rework HFSC vs FQ-CoDel checks
The selection mechanism introduced in pf_ioctl.c -r1.316 suffers from being too ambiguous and lacks robustness. Instead of relying on composition of multiple flags in the queue specification, it's easier to identify the root class (if it exists) and derive all further checks from it.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf_ioctl.c13
-rw-r--r--sys/net/pfvar.h3
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 7c9df05a53b..4661c897487 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.318 2017/07/05 11:40:17 bluhm Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.319 2017/07/19 12:51:30 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -606,12 +606,12 @@ pf_create_queues(void)
qif = malloc(sizeof(*qif), M_TEMP, M_WAITOK);
qif->ifp = ifp;
- if ((q->flags & PFQS_FLOWQUEUE) && !(q->flags & PFQS_DEFAULT)) {
- qif->ifqops = ifq_fqcodel_ops;
- qif->pfqops = pfq_fqcodel_ops;
- } else {
+ if (q->flags & PFQS_ROOTCLASS) {
qif->ifqops = ifq_hfsc_ops;
qif->pfqops = pfq_hfsc_ops;
+ } else {
+ qif->ifqops = ifq_fqcodel_ops;
+ qif->pfqops = pfq_fqcodel_ops;
}
qif->disc = qif->pfqops->pfq_alloc(ifp);
@@ -1104,8 +1104,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
break;
}
bcopy(qs, &pq->queue, sizeof(pq->queue));
+ /* It's a root flow queue but is not an HFSC root class */
if ((qs->flags & PFQS_FLOWQUEUE) && qs->parent_qid == 0 &&
- !(qs->flags & PFQS_DEFAULT))
+ !(qs->flags & PFQS_ROOTCLASS))
error = pfq_fqcodel_ops->pfq_qstats(qs, pq->buf,
&nbytes);
else
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 5adcff5042e..4f43739687d 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.460 2017/06/28 19:30:24 mikeb Exp $ */
+/* $OpenBSD: pfvar.h,v 1.461 2017/07/19 12:51:31 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1343,6 +1343,7 @@ struct pf_queuespec {
};
#define PFQS_FLOWQUEUE 0x0001
+#define PFQS_ROOTCLASS 0x0002
#define PFQS_DEFAULT 0x1000 /* maps to HFSC_DEFAULTCLASS */
struct priq_opts {