summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl_altq.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-03-06 12:50:41 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-03-06 12:50:41 +0000
commitded1ec0e57ba4e11a0dd959b0062467ec2664efc (patch)
tree8e6b4a2f35ae402e866579806b84db81ce82c301 /sbin/pfctl/pfctl_altq.c
parentadb0220a2d6b6e6b3fcd2a1fb176d8e82b76df96 (diff)
fix queue assignment on filter rules which are not bound to an interface.
when looking up the queue IDs using qname_to_qid, we do not need to limit the matching on the interface in question, as it is guaranteed that same named queues on different interfaces habe the same queue id. moreover, we must not limit the matches to the interface if we do not have an interface given on the filter rule to match on ;-) found after problems reported by Andre Nathan <andre at v2r dot com dot br> ok dhartmei@ pb@ cedric@
Diffstat (limited to 'sbin/pfctl/pfctl_altq.c')
-rw-r--r--sbin/pfctl/pfctl_altq.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index 3045d4d0cf4..a662b8c50d2 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_altq.c,v 1.41 2003/03/03 14:16:18 henning Exp $ */
+/* $OpenBSD: pfctl_altq.c,v 1.42 2003/03/06 12:50:40 henning Exp $ */
/*
* Copyright (C) 2002
@@ -134,14 +134,18 @@ qname_to_pfaltq(const char *qname, const char *ifname)
}
u_int32_t
-qname_to_qid(const char *qname, const char *ifname)
+qname_to_qid(const char *qname)
{
struct pf_altq *altq;
+ /*
+ * We guarantee that same named queues on different interfaces
+ * have the same qid, so we do NOT need to limit matching on
+ * one interface!
+ */
+
TAILQ_FOREACH(altq, &altqs, entries) {
- if ((ifname == NULL ||
- strncmp(ifname, altq->ifname, IFNAMSIZ) == 0) &&
- strncmp(qname, altq->qname, PF_QNAME_SIZE) == 0)
+ if (strncmp(qname, altq->qname, PF_QNAME_SIZE) == 0)
return (altq->qid);
}
return (0);
@@ -318,7 +322,7 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute,
errx(1, "altq not defined on %s", pa->ifname);
pa->scheduler = if_pa->scheduler;
pa->ifbandwidth = if_pa->ifbandwidth;
- pa->qid = qname_to_qid(pa->qname, NULL);
+ pa->qid = qname_to_qid(pa->qname);
parent = NULL;
if (pa->parent[0] != 0) {