diff options
author | 2003-03-10 14:50:29 +0000 | |
---|---|---|
committer | 2003-03-10 14:50:29 +0000 | |
commit | ea7c001bbf8f09bded1a3a181565203b2212af58 (patch) | |
tree | dd8f4302fdd4d18be67e58f1e688854a01ae0bf1 | |
parent | rework error handling in eval_pfqueue(). (diff) | |
download | wireguard-openbsd-ea7c001bbf8f09bded1a3a181565203b2212af58.tar.xz wireguard-openbsd-ea7c001bbf8f09bded1a3a181565203b2212af58.zip |
correctly cope with errors returned by eval_pfqueue and pfctl_add_altq
ok dhartmei@ pb@ (as part of... you know, monsterdiff)
-rw-r--r-- | sbin/pfctl/parse.y | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 60abd26c741..276b4b4154a 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.341 2003/03/10 14:46:09 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.342 2003/03/10 14:50:29 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -3137,8 +3137,8 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, { struct node_queue *n; struct pf_altq pa; - u_int8_t added = 0; u_int8_t found = 0; + u_int8_t errs = 0; if ((pf->loadopt & (PFCTL_FLAG_ALTQ | PFCTL_FLAG_ALL)) == 0) { FREE_LIST(struct node_queue, nqueues); @@ -3191,10 +3191,12 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, sizeof(pa.parent)) >= sizeof(pa.parent)) errx(1, "expand_queue: strlcpy"); - if (!eval_pfqueue(pf, &pa, bwspec.bw_absolute, + if (eval_pfqueue(pf, &pa, bwspec.bw_absolute, bwspec.bw_percent)) - if (!pfctl_add_altq(pf, &pa)) - added++; + errs++; + else + if (pfctl_add_altq(pf, &pa)) + errs++; if (nqueues == NULL) continue; @@ -3240,10 +3242,14 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, FREE_LIST(struct node_queue, nqueues); - if (!added) { - yyerror("queue has no parent"); + if (!found) { + yyerror("queue %s has no parent", a->qname); + errs++; + } + + if (errs) return (1); - } else + else return (0); } |