diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-09 18:58:26 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-09 18:58:26 +0000 |
commit | f8fedce081a30f00310cc6ef4be38bdb063c046c (patch) | |
tree | bdaf6bc24b0e15afd7680aba04a0a874e653350f | |
parent | 373547550d943cc9dd24b1c1e0b89330ccf3be16 (diff) |
cope with the fact that LOOP_THROUGH loops once even if the list is empty by
moving the addition of child queues a bit down after the successfull
addition of the current queue and an explicit NULL check before looping.
fixes regress pf59
found by kjc@
ok kjc@ cedric@ dhartmei@
-rw-r--r-- | sbin/pfctl/parse.y | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index c4ae66c5491..1afae54beb6 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.338 2003/03/08 15:17:34 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.339 2003/03/09 18:58:25 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -3178,6 +3178,21 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, break; } + if (strlcpy(pa.ifname, tqueue->ifname, + sizeof(pa.ifname)) >= sizeof(pa.ifname)) + errx(1, "expand_queue: strlcpy"); + if (strlcpy(pa.parent, tqueue->parent, + sizeof(pa.parent)) >= sizeof(pa.parent)) + errx(1, "expand_queue: strlcpy"); + + if (!eval_pfqueue(pf, &pa, bwspec.bw_absolute, + bwspec.bw_percent)) + if (!pfctl_add_altq(pf, &pa)) + added++; + + if (nqueues == NULL) + continue; + LOOP_THROUGH(struct node_queue, queue, nqueues, n = calloc(1, sizeof(struct node_queue)); if (n == NULL) @@ -3201,17 +3216,6 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, queues->tail = n; } ); - if (strlcpy(pa.ifname, tqueue->ifname, - sizeof(pa.ifname)) >= sizeof(pa.ifname)) - errx(1, "expand_queue: strlcpy"); - if (strlcpy(pa.parent, tqueue->parent, - sizeof(pa.parent)) >= sizeof(pa.parent)) - errx(1, "expand_queue: strlcpy"); - - if (!eval_pfqueue(pf, &pa, bwspec.bw_absolute, - bwspec.bw_percent)) - if (!pfctl_add_altq(pf, &pa)) - added++; } ); |