diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-06 12:50:41 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-06 12:50:41 +0000 |
commit | ded1ec0e57ba4e11a0dd959b0062467ec2664efc (patch) | |
tree | 8e6b4a2f35ae402e866579806b84db81ce82c301 /sbin/pfctl | |
parent | adb0220a2d6b6e6b3fcd2a1fb176d8e82b76df96 (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')
-rw-r--r-- | sbin/pfctl/parse.y | 6 | ||||
-rw-r--r-- | sbin/pfctl/pfctl.h | 4 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_altq.c | 16 |
3 files changed, 15 insertions, 11 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 4fae66177a9..c088b246fb3 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.335 2003/03/02 23:37:24 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.336 2003/03/06 12:50:40 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -3295,8 +3295,8 @@ expand_rule(struct pf_rule *r, errx(1, "expand_rule: strlcpy"); expand_label(r->label, r->ifname, r->af, src_host, src_port, dst_host, dst_port, proto->proto); - r->qid = qname_to_qid(r->qname, r->ifname); - if ((r->pqid = qname_to_qid(r->pqname, r->ifname)) == 0) + r->qid = qname_to_qid(r->qname); + if ((r->pqid = qname_to_qid(r->pqname)) == 0) r->pqid = r->qid; r->ifnot = interface->not; r->proto = proto->proto; diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 2772f3d2d50..e5ee5a68c2f 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.h,v 1.11 2003/03/02 23:37:24 henning Exp $ */ +/* $OpenBSD: pfctl.h,v 1.12 2003/03/06 12:50:40 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -81,7 +81,7 @@ void pfaltq_store(struct pf_altq *); void pfaltq_free(struct pf_altq *); struct pf_altq *pfaltq_lookup(const char *); struct pf_altq *qname_to_pfaltq(const char *, const char *); -u_int32_t qname_to_qid(const char *, const char *); +u_int32_t qname_to_qid(const char *); char *qid_to_qname(u_int32_t, const char *); char *rate2str(double); 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) { |