summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-02-03 13:40:46 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-02-03 13:40:46 +0000
commit60c6f58cd9fc50f82e3e2e637b40fe29b7e83bac (patch)
treef693dbc06b65fd2f24b466e53ad25eafabe7e5c5 /sbin
parent18a8f4b1d9fd6f8ca7b200916d51f2a12bd88dab (diff)
fix a problem with queue definitions when load options (like -N etc) are
given; they used to check for their parent interface/queue even in this case. ok dhartmei@ cedric@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y13
-rw-r--r--sbin/pfctl/pfctl.c3
-rw-r--r--sbin/pfctl/pfctl_parser.h3
3 files changed, 16 insertions, 3 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 3d6c01a1ea3..62b97545ba6 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.302 2003/02/02 23:22:07 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.303 2003/02/03 13:40:45 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -3022,6 +3022,12 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces,
struct node_queue *n;
int errs = 0;
+ if ((pf->loadopt & (PFCTL_FLAG_ALTQ | PFCTL_FLAG_ALL)) == 0) {
+ FREE_LIST(struct node_if, interfaces);
+ FREE_LIST(struct node_queue, nqueues);
+ return (0);
+ }
+
LOOP_THROUGH(struct node_if, interface, interfaces,
memcpy(&pa, a, sizeof(struct pf_altq));
if (strlcpy(pa.ifname, interface->ifname,
@@ -3119,6 +3125,11 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues,
u_int8_t added = 0;
u_int8_t found = 0;
+ if ((pf->loadopt & (PFCTL_FLAG_ALTQ | PFCTL_FLAG_ALL)) == 0) {
+ FREE_LIST(struct node_queue, nqueues);
+ return (0);
+ }
+
LOOP_THROUGH(struct node_queue, tqueue, queues,
if (!strncmp(a->qname, tqueue->queue, PF_QNAME_SIZE)) {
/* found ourselve in queues */
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 89824c704cd..a0936f600be 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.142 2003/02/02 23:22:07 henning Exp $ */
+/* $OpenBSD: pfctl.c,v 1.143 2003/02/03 13:40:45 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -968,6 +968,7 @@ pfctl_rules(int dev, char *filename, int opts)
/* fill in callback data */
pf.dev = dev;
pf.opts = opts;
+ pf.loadopt = loadopt;
pf.paltq = &pa;
for (i = 0; i < PF_RULESET_MAX; i++) {
pf.prule[i] = &pr[i];
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index 983afd5ed0c..dd0a8c1307a 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.h,v 1.45 2003/02/02 23:22:07 henning Exp $ */
+/* $OpenBSD: pfctl_parser.h,v 1.46 2003/02/03 13:40:45 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -58,6 +58,7 @@
struct pfctl {
int dev;
int opts;
+ int loadopt;
u_int32_t rule_nr;
struct pfioc_pooladdr paddr;
struct pfioc_rule *prule[PF_RULESET_MAX];