diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-19 12:58:32 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2017-07-19 12:58:32 +0000 |
commit | 73e1e83dbf82a157cabd46893fd78e4f65fe6791 (patch) | |
tree | a9b7fdd56402f115ddb6577bb5b515acd3c738fa /sbin/pfctl/pfctl.c | |
parent | 389e6234935005a935435b45d55d8d9835cd5850 (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/pfctl.c')
-rw-r--r-- | sbin/pfctl/pfctl.c | 34 |
1 files changed, 25 insertions, 9 deletions
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) |