summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2006-11-05 07:19:31 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2006-11-05 07:19:31 +0000
commit00a2241f1b6f4532e8dc6b61739466bed0cbf27b (patch)
treec5f9348838e6106ae3625675097ec18dcfd6fef9
parentc196511818c0a39d887e6e574ea3303fa1d9c79d (diff)
Don't open a transaction for a ruleset unless it's a brace ruleset that
contains rules. Fixes DIOCXCOMMIT: Device busy when multiple anchors with the same name are specified. reported by ckuethe@ and mkb@crypt.org.ru
-rw-r--r--sbin/pfctl/pfctl.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 763edbc510f..44aba92d073 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.253 2006/11/01 12:27:26 jmc Exp $ */
+/* $OpenBSD: pfctl.c,v 1.254 2006/11/05 07:19:30 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1069,26 +1069,26 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs,
else
snprintf(&path[len], MAXPATHLEN - len, "%s", pf->anchor->name);
- if (rs != &pf->astack[0]->ruleset &&
- ((pf->opts & PF_OPT_NOACTION) == 0)) {
- if ((error = pfctl_ruleset_trans(pf, path, rs->anchor))) {
- printf("pfctl_load_rulesets: "
- "pfctl_ruleset_trans %d\n", error);
- goto error;
- }
- }
-
- if (pf->optimize && rs_num == PF_RULESET_FILTER)
- pfctl_optimize_ruleset(pf, rs);
-
if (pf->opts & PF_OPT_VERBOSE && depth) {
if (TAILQ_FIRST(rs->rules[rs_num].active.ptr) != NULL) {
brace++;
printf(" {\n");
+ if ((pf->opts & PF_OPT_NOACTION) == 0) {
+ if ((error = pfctl_ruleset_trans(pf,
+ path, rs->anchor))) {
+ printf("pfctl_load_rulesets: "
+ "pfctl_ruleset_trans %d\n", error);
+ goto error;
+ }
+ }
} else
printf("\n");
}
+ if (pf->optimize && rs_num == PF_RULESET_FILTER)
+ pfctl_optimize_ruleset(pf, rs);
+
+
while ((r = TAILQ_FIRST(rs->rules[rs_num].active.ptr)) != NULL) {
TAILQ_REMOVE(rs->rules[rs_num].active.ptr, r, entries);
if ((error = pfctl_load_rule(pf, path, r, depth)))