summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-03-08 14:52:18 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-03-08 14:52:18 +0000
commit4f655e4f6914335f297f6d8e09ea6a6e48644a21 (patch)
tree003bfdf65617876d5a041809e66a54cf69d50169 /sbin
parent7511fff6b92b981f80f2d05d55539dfd466b7e5b (diff)
in expand_queue, make a private copy of the struct pf_altq before modifying
it. modifying the original one had undesired side effects if a queue was expanded to more than one because it belonged to more than one interface ok pb@ cedric@ dhartmei@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y25
1 files changed, 14 insertions, 11 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index c088b246fb3..736adb5a542 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.336 2003/03/06 12:50:40 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.337 2003/03/08 14:52:17 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -3136,6 +3136,7 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues,
struct node_queue_bw bwspec)
{
struct node_queue *n;
+ struct pf_altq pa;
u_int8_t added = 0;
u_int8_t found = 0;
@@ -3149,16 +3150,18 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues,
/* found ourselve in queues */
found++;
- if (a->scheduler != ALTQT_NONE &&
- a->scheduler != tqueue->scheduler) {
+ memcpy(&pa, a, sizeof(struct pf_altq));
+
+ if (pa.scheduler != ALTQT_NONE &&
+ pa.scheduler != tqueue->scheduler) {
yyerror("exactly one scheduler type per "
"interface allowed");
return (1);
}
- a->scheduler = tqueue->scheduler;
+ pa.scheduler = tqueue->scheduler;
/* scheduler dependent error checking */
- switch (a->scheduler) {
+ switch (pa.scheduler) {
case ALTQT_PRIQ:
if (nqueues != NULL) {
yyerror("priq queues cannot have "
@@ -3198,16 +3201,16 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues,
queues->tail = n;
}
);
- if (strlcpy(a->ifname, tqueue->ifname,
- sizeof(a->ifname)) >= sizeof(a->ifname))
+ if (strlcpy(pa.ifname, tqueue->ifname,
+ sizeof(pa.ifname)) >= sizeof(pa.ifname))
errx(1, "expand_queue: strlcpy");
- if (strlcpy(a->parent, tqueue->parent,
- sizeof(a->parent)) >= sizeof(a->parent))
+ if (strlcpy(pa.parent, tqueue->parent,
+ sizeof(pa.parent)) >= sizeof(pa.parent))
errx(1, "expand_queue: strlcpy");
- if (!eval_pfqueue(pf, a, bwspec.bw_absolute,
+ if (!eval_pfqueue(pf, &pa, bwspec.bw_absolute,
bwspec.bw_percent))
- if (!pfctl_add_altq(pf, a))
+ if (!pfctl_add_altq(pf, &pa))
added++;
}
);