summaryrefslogtreecommitdiff
path: root/sys/net/pf_ioctl.c
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2018-12-27 16:54:02 +0000
committerkn <kn@cvs.openbsd.org>2018-12-27 16:54:02 +0000
commitbdd595b34e6a5cfb6b6ebfa277976d530eecbf38 (patch)
treefeb5b4f818a05f6622f3b48a36c135c3b6a455dd /sys/net/pf_ioctl.c
parenta23e62285de6ad1daa83b99c722ebf7882d3cabd (diff)
Check for main ruleset explicitly
All rulesets reference their parent anchor, except for the special cased main anchor containing the main ruleset, which's reference is always NULL since initialization and never changes. Replacing nullity tests with clearer equality checks makes the code less ambigious and easier to understand. OK sashan
Diffstat (limited to 'sys/net/pf_ioctl.c')
-rw-r--r--sys/net/pf_ioctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index a4c7fceed47..5220cd02ed0 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.341 2018/12/17 15:37:41 kn Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.342 2018/12/27 16:54:01 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1945,7 +1945,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
break;
}
pr->nr = 0;
- if (ruleset->anchor == NULL) {
+ if (ruleset == &pf_main_ruleset) {
/* XXX kludge for pf_main_ruleset */
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
if (anchor->parent == NULL)
@@ -1973,7 +1973,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
break;
}
pr->name[0] = 0;
- if (ruleset->anchor == NULL) {
+ if (ruleset == &pf_main_ruleset) {
/* XXX kludge for pf_main_ruleset */
RB_FOREACH(anchor, pf_anchor_global, &pf_anchors)
if (anchor->parent == NULL && nr++ == pr->nr) {