summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl_altq.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-12-17 20:06:06 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-12-17 20:06:06 +0000
commit75aa64eeb6c2773b729a6c953f99f4fc76a9c7b0 (patch)
tree8a7171121aa8fb7dc4a1d4a94490b291df9c7194 /sbin/pfctl/pfctl_altq.c
parent4e4f1f07e39d95aa348511b7ef0121e2f263754c (diff)
add support for the PRIQ scheduler
partitially from kjc@ ok kjc@ dhartmei@
Diffstat (limited to 'sbin/pfctl/pfctl_altq.c')
-rw-r--r--sbin/pfctl/pfctl_altq.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index e35b34a10ec..78567709127 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_altq.c,v 1.24 2002/12/17 11:29:04 henning Exp $ */
+/* $OpenBSD: pfctl_altq.c,v 1.25 2002/12/17 20:06:05 henning Exp $ */
/*
* Copyright (C) 2002
@@ -203,7 +203,8 @@ print_queue(const struct pf_altq *a, unsigned level)
for (i = 0; i < level; ++i)
printf(" ");
printf("%s ", a->qname);
- printf("bandwidth %s ", rate2str((double)a->bandwidth));
+ if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC)
+ printf("bandwidth %s ", rate2str((double)a->bandwidth));
if (a->priority != DEFAULT_PRIORITY)
printf("priority %u ", a->priority);
if (a->qlimit != DEFAULT_QLIMIT)
@@ -320,18 +321,22 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute,
if (pa->qlimit == 0)
pa->qlimit = DEFAULT_QLIMIT;
- if (bw_absolute > 0)
- pa->bandwidth = bw_absolute;
- else if (bw_percent > 0 && parent != NULL)
- pa->bandwidth = parent->bandwidth / 100 * bw_percent;
- else
- errx(1, "bandwidth for %s invalid (%d / %d)", pa->qname,
- bw_absolute, bw_percent);
+ if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC) {
+ if (bw_absolute > 0)
+ pa->bandwidth = bw_absolute;
+ else if (bw_percent > 0 && parent != NULL)
+ pa->bandwidth = parent->bandwidth / 100 * bw_percent;
+ else
+ errx(1, "bandwidth for %s invalid (%d / %d)", pa->qname,
+ bw_absolute, bw_percent);
- if (pa->bandwidth > pa->ifbandwidth)
- errx(1, "bandwidth for %s higher than interface", pa->qname);
- if (parent != NULL && pa->bandwidth > parent->bandwidth)
- errx(1, "bandwidth for %s higher than parent", pa->qname);
+ if (pa->bandwidth > pa->ifbandwidth)
+ errx(1, "bandwidth for %s higher than interface",
+ pa->qname);
+ if (parent != NULL && pa->bandwidth > parent->bandwidth)
+ errx(1, "bandwidth for %s higher than parent",
+ pa->qname);
+ }
switch (pa->scheduler) {
case ALTQT_CBQ:
@@ -552,10 +557,6 @@ eval_pfqueue_priq(struct pfctl *pf, struct pf_altq *pa)
{
struct pf_altq *altq;
- if (pa->parent[0] == 0)
- /* this is for dummy root */
- return (0);
-
if (pa->priority >= PRIQ_MAXPRI) {
warnx("priority out of range: max %d", PRIQ_MAXPRI - 1);
return (-1);
@@ -563,17 +564,13 @@ eval_pfqueue_priq(struct pfctl *pf, struct pf_altq *pa)
/* the priority should be unique for the interface */
TAILQ_FOREACH(altq, &altqs, entries) {
if (strncmp(altq->ifname, pa->ifname, IFNAMSIZ) == 0 &&
- altq->qname[0] != 0 && altq->parent[0] != 0 &&
- altq->priority == pa->priority) {
+ altq->qname[0] != 0 && altq->priority == pa->priority) {
warnx("%s and %s have the same priority",
altq->qname, pa->qname);
return (-1);
}
}
- if (pa->bandwidth != pa->ifbandwidth)
- warnx("priq does not have a bandwidth parameter -- ignored");
-
return (0);
}
@@ -593,8 +590,6 @@ check_commit_priq(int dev, int opts, struct pf_altq *pa)
continue;
if (altq->qname[0] == 0) /* this is for interface */
continue;
- if (altq->parent[0] == 0) /* dummy root */
- continue;
if (altq->pq_u.priq_opts.flags & PRCF_DEFAULTCLASS)
default_class++;
}