summaryrefslogtreecommitdiff
path: root/sys/net/pf_table.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-11-22 12:56:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-11-22 12:56:05 +0000
commita64a5a717fb37c5b53c8bc732b4a21ce8d022f3b (patch)
tree1e2f9675cc1ce4109db8c16a8b0df6163c3014a4 /sys/net/pf_table.c
parente1d2a6abef22778a6bcc3d7204c540813eee3cbb (diff)
move PFR_TFLAG_CONST test, missed in rev 1.138
prompted by uninitialised var found by bluhm@ running regress on sparc64 ok sashan@
Diffstat (limited to 'sys/net/pf_table.c')
-rw-r--r--sys/net/pf_table.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index 3f895b4429d..fb23bcabe04 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.138 2021/11/16 20:51:31 sashan Exp $ */
+/* $OpenBSD: pf_table.c,v 1.139 2021/11/22 12:56:04 jsg Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -321,8 +321,6 @@ pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY | PFR_FLAG_FEEDBACK);
if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL))
return (EINVAL);
- if (kt->pfrkt_flags & PFR_TFLAG_CONST)
- return (EPERM);
tmpkt = pfr_create_ktable(&pfr_nulltable, 0, 0,
!(flags & PFR_FLAG_USERIOCTL));
if (tmpkt == NULL)
@@ -351,6 +349,11 @@ pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
NET_UNLOCK();
senderr(ESRCH);
}
+ if (kt->pfrkt_flags & PFR_TFLAG_CONST) {
+ PF_UNLOCK();
+ NET_UNLOCK();
+ senderr(EPERM);
+ }
SLIST_FOREACH(ke, &ioq, pfrke_ioq) {
pfr_kentry_kif_ref(ke);
p = pfr_lookup_kentry(kt, ke, 1);