From: jsg Date: Mon, 22 Nov 2021 12:56:04 +0000 (+0000) Subject: move PFR_TFLAG_CONST test, missed in rev 1.138 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ac7c051c054eee5ed63de6d85c5e5ba3d640b4e1;p=openbsd move PFR_TFLAG_CONST test, missed in rev 1.138 prompted by uninitialised var found by bluhm@ running regress on sparc64 ok sashan@ --- 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);