diff options
author | 2006-11-05 07:19:30 +0000 | |
---|---|---|
committer | 2006-11-05 07:19:30 +0000 | |
commit | 37b4235329bd11a945f74714d1fb29424c60033a (patch) | |
tree | 375083f71b1ba1c9c89913135396a8f0796ea217 | |
parent | define the bit that sh4 uses for FPU disable. (diff) | |
download | wireguard-openbsd-37b4235329bd11a945f74714d1fb29424c60033a.tar.xz wireguard-openbsd-37b4235329bd11a945f74714d1fb29424c60033a.zip |
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.c | 26 |
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))) |