diff options
author | kn <kn@cvs.openbsd.org> | 2018-12-17 15:37:42 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2018-12-17 15:37:42 +0000 |
commit | 3f2c84b601c3b92663db94d7335a0917edcffdff (patch) | |
tree | 7c5e68b03b0078e3075b289bfb9dc6bc14654bb3 /sys/net | |
parent | 694f21ee3a364e4979b4985b5e8ae4b813d653a8 (diff) |
Rename pf_anchor_remove() to pf_remove_anchor()
For semantic consistency with pf_{create,find,remove}_{anchor,ruleset}().
Simplify logic by squashing the if/else block while here.
No functional change.
Feedback jca and mikeb, OK mikeb
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pf_ioctl.c | 4 | ||||
-rw-r--r-- | sys/net/pf_ruleset.c | 14 | ||||
-rw-r--r-- | sys/net/pfvar.h | 4 |
3 files changed, 9 insertions, 13 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 160f3bb2b86..a4c7fceed47 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.340 2018/12/17 09:11:11 claudio Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.341 2018/12/17 15:37:41 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -316,7 +316,7 @@ pf_rm_rule(struct pf_rulequeue *rulequeue, struct pf_rule *rule) pfi_kif_unref(rule->rdr.kif, PFI_KIF_REF_RULE); pfi_kif_unref(rule->nat.kif, PFI_KIF_REF_RULE); pfi_kif_unref(rule->route.kif, PFI_KIF_REF_RULE); - pf_anchor_remove(rule); + pf_remove_anchor(rule); pool_put(&pf_rule_pl, rule); } diff --git a/sys/net/pf_ruleset.c b/sys/net/pf_ruleset.c index 108db53fea1..11233e4069d 100644 --- a/sys/net/pf_ruleset.c +++ b/sys/net/pf_ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ruleset.c,v 1.16 2017/09/05 22:15:32 sashan Exp $ */ +/* $OpenBSD: pf_ruleset.c,v 1.17 2018/12/17 15:37:41 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -413,17 +413,13 @@ pf_anchor_copyout(const struct pf_ruleset *rs, const struct pf_rule *r, } void -pf_anchor_remove(struct pf_rule *r) +pf_remove_anchor(struct pf_rule *r) { if (r->anchor == NULL) return; - if (r->anchor->refcnt <= 0) { - DPFPRINTF(LOG_NOTICE, - "pf_anchor_remove: broken refcount"); - r->anchor = NULL; - return; - } - if (!--r->anchor->refcnt) + if (r->anchor->refcnt <= 0) + DPFPRINTF(LOG_NOTICE, "pf_remove_anchor: broken refcount"); + else if (!--r->anchor->refcnt) pf_remove_if_empty_ruleset(&r->anchor->ruleset); r->anchor = NULL; } diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e25e7c03903..67283c9463b 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.488 2018/12/10 16:48:15 kn Exp $ */ +/* $OpenBSD: pfvar.h,v 1.489 2018/12/17 15:37:41 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1903,7 +1903,7 @@ int pf_anchor_setup(struct pf_rule *, const struct pf_ruleset *, const char *); int pf_anchor_copyout(const struct pf_ruleset *, const struct pf_rule *, struct pfioc_rule *); -void pf_anchor_remove(struct pf_rule *); +void pf_remove_anchor(struct pf_rule *); void pf_remove_if_empty_ruleset(struct pf_ruleset *); struct pf_anchor *pf_find_anchor(const char *); struct pf_ruleset *pf_find_ruleset(const char *); |