summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-19 12:58:32 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-07-19 12:58:32 +0000
commit73e1e83dbf82a157cabd46893fd78e4f65fe6791 (patch)
treea9b7fdd56402f115ddb6577bb5b515acd3c738fa /sbin/pfctl
parent389e6234935005a935435b45d55d8d9835cd5850 (diff)
Allow HFSC classes to use flow queues
The FQ-CoDel related configuration (flows, quantum) becomes available for the regular bandwidth queue. Internally the kernel will pick the FQ-CoDel for use as a queue manager for the specified class instead of the FIFO. Discussed with and OK henning@ at d2k17 as a part of a larger diff.
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y12
-rw-r--r--sbin/pfctl/pfctl.c34
-rw-r--r--sbin/pfctl/pfctl_parser.c5
3 files changed, 29 insertions, 22 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 5ab84c9fa8e..5ae134e04a2 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.661 2017/07/19 12:51:30 mikeb Exp $ */
+/* $OpenBSD: parse.y,v 1.662 2017/07/19 12:58:31 mikeb Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -1324,11 +1324,6 @@ queue_opt : BANDWIDTH scspec optscs {
yyerror("bandwidth cannot be respecified");
YYERROR;
}
- if (queue_opts.marker & QOM_FLOWS) {
- yyerror("bandwidth cannot be specified for "
- "a flow queue");
- YYERROR;
- }
queue_opts.marker |= QOM_BWSPEC;
queue_opts.linkshare = $2;
queue_opts.realtime= $3.realtime;
@@ -1367,11 +1362,6 @@ queue_opt : BANDWIDTH scspec optscs {
yyerror("number of flows cannot be respecified");
YYERROR;
}
- if (queue_opts.marker & QOM_BWSPEC) {
- yyerror("bandwidth cannot be specified for "
- "a flow queue");
- YYERROR;
- }
if ($2 < 1 || $2 > 32767) {
yyerror("number of flows out of range: "
"max 32767");
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index e97a7f3f213..281cd939c6e 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.346 2017/07/19 12:51:30 mikeb Exp $ */
+/* $OpenBSD: pfctl.c,v 1.347 2017/07/19 12:58:31 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1299,8 +1299,14 @@ pfctl_find_childqs(struct pfctl_qsitem *qi)
TAILQ_FOREACH(p, &qi->children, entries)
flags |= pfctl_find_childqs(p);
- if (qi->qs.flags & PFQS_DEFAULT && !TAILQ_EMPTY(&qi->children))
- errx(1, "default queue %s is not a leaf queue", qi->qs.qname);
+ if (!TAILQ_EMPTY(&qi->children)) {
+ if (qi->qs.flags & PFQS_DEFAULT)
+ errx(1, "default queue %s is not a leaf queue",
+ qi->qs.qname);
+ if (qi->qs.flags & PFQS_FLOWQUEUE)
+ errx(1, "flow queue %s is not a leaf queue",
+ qi->qs.qname);
+ }
return (flags);
}
@@ -1329,18 +1335,28 @@ int
pfctl_load_queues(struct pfctl *pf)
{
struct pfctl_qsitem *qi, *tempqi;
+ struct pf_queue_scspec *rtsc, *lssc, *ulsc;
u_int32_t ticket;
TAILQ_FOREACH(qi, &qspecs, entries) {
if (qi->matches == 0)
- errx(1, "queue %s: parent %s not found\n", qi->qs.qname,
+ errx(1, "queue %s: parent %s not found", qi->qs.qname,
qi->qs.parent);
- if (qi->qs.realtime.m1.percent || qi->qs.realtime.m2.percent ||
- qi->qs.linkshare.m1.percent ||
- qi->qs.linkshare.m2.percent ||
- qi->qs.upperlimit.m1.percent ||
- qi->qs.upperlimit.m2.percent)
+
+ rtsc = &qi->qs.realtime;
+ lssc = &qi->qs.linkshare;
+ ulsc = &qi->qs.upperlimit;
+
+ if (rtsc->m1.percent || rtsc->m2.percent ||
+ lssc->m1.percent || lssc->m2.percent ||
+ ulsc->m1.percent || ulsc->m2.percent)
errx(1, "only absolute bandwidth specs for now");
+
+ /* Link sharing policy must be specified for child classes */
+ if (qi->qs.parent[0] != '\0' &&
+ lssc->m1.absolute == 0 && lssc->m2.absolute == 0)
+ errx(1, "queue %s: no bandwidth was specified",
+ qi->qs.qname);
}
if ((pf->opts & PF_OPT_NOACTION) == 0)
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 8f5ec3ff291..ff88383aed7 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.312 2017/06/01 14:38:28 patrick Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.313 2017/07/19 12:58:31 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1213,7 +1213,8 @@ print_queuespec(struct pf_queuespec *q)
if (q->flowqueue.target > 0)
printf(" target %ums",
q->flowqueue.target / 1000000);
- } else {
+ }
+ if (q->linkshare.m1.absolute || q->linkshare.m2.absolute) {
print_scspec(" bandwidth ", &q->linkshare);
print_scspec(", min ", &q->realtime);
print_scspec(", max ", &q->upperlimit);