diff options
author | 2014-08-12 14:38:27 +0000 | |
---|---|---|
committer | 2014-08-12 14:38:27 +0000 | |
commit | 9dd330a2b72cdce33cebff8422e672e3e8d99070 (patch) | |
tree | b8b80363e7b12a844d30e9b73b4ce20ad2e4a40b | |
parent | route_cb is internal to rtsock.c (diff) | |
download | wireguard-openbsd-9dd330a2b72cdce33cebff8422e672e3e8d99070.tar.xz wireguard-openbsd-9dd330a2b72cdce33cebff8422e672e3e8d99070.zip |
Apart from some minor code reshuffling the big change is that we
start with a ruleset pointer assigned to pf_main_ruleset so that
pf_purge_rule doesn't get called with a NULL.
Prompted by the discussion with Alexandr Nedvedicky <alexandr !
nedvedicky at oracle ! com>.
OK henning
-rw-r--r-- | sys/net/pf.c | 3 | ||||
-rw-r--r-- | sys/net/pf_ioctl.c | 11 |
2 files changed, 5 insertions, 9 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index a5d9aadbf33..dae2d8b24da 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.883 2014/07/22 11:06:09 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.884 2014/08/12 14:38:27 mikeb Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -3165,6 +3165,7 @@ pf_test_rule(struct pf_pdesc *pd, struct pf_rule **rm, struct pf_state **sm, #endif /* INET6 */ } + ruleset = &pf_main_ruleset; r = TAILQ_FIRST(pf_main_ruleset.rules.active.ptr); while (r != NULL) { r->evaluations++; diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 735ff7d6ffd..a4dba038b8d 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.274 2014/07/22 11:06:09 mpi Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.275 2014/08/12 14:38:28 mikeb Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -309,20 +309,15 @@ pf_rm_rule(struct pf_rulequeue *rulequeue, struct pf_rule *rule) void pf_purge_rule(struct pf_ruleset *ruleset, struct pf_rule *rule) { - u_int32_t nr; + u_int32_t nr = 0; - if (ruleset == NULL || ruleset->anchor == NULL) - return; + KASSERT(ruleset != NULL && rule != NULL); pf_rm_rule(ruleset->rules.active.ptr, rule); ruleset->rules.active.rcount--; - - nr = 0; TAILQ_FOREACH(rule, ruleset->rules.active.ptr, entries) rule->nr = nr++; - ruleset->rules.active.ticket++; - pf_calc_skip_steps(ruleset->rules.active.ptr); pf_remove_if_empty_ruleset(ruleset); } |