From owner-dev-commits-src-main@freebsd.org Mon Apr 19 13:44:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428D15F2B90; Mon, 19 Apr 2021 13:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FP7Md1T9Cz4Qxg; Mon, 19 Apr 2021 13:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2544A20503; Mon, 19 Apr 2021 13:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13JDiDCt056983; Mon, 19 Apr 2021 13:44:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13JDiDv9056982; Mon, 19 Apr 2021 13:44:13 GMT (envelope-from git) Date: Mon, 19 Apr 2021 13:44:13 GMT Message-Id: <202104191344.13JDiDv9056982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 4f1f67e88853 - main - pf: PFRULE_REFS should not be user-visible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 13:44:13 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e commit 4f1f67e88853ac9e3c2d8897cf6dab6cfda8d16e Author: Kristof Provost AuthorDate: 2021-04-15 11:38:56 +0000 Commit: Kristof Provost CommitDate: 2021-04-19 12:31:47 +0000 pf: PFRULE_REFS should not be user-visible Split the PFRULE_REFS flag from the rule_flag field. PFRULE_REFS is a kernel-internal flag and should not be exposed to or read from userspace. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29778 --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.c | 12 ++++++------ sys/netpfil/pf/pf_ioctl.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0372dfa65e57..efb9a382511e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -378,6 +378,7 @@ struct pf_krule { struct pf_rule_gid gid; u_int32_t rule_flag; + uint32_t rule_ref; u_int8_t action; u_int8_t direction; u_int8_t log; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index e4bc6447b0d1..a5c4ef6bfbb4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1641,7 +1641,7 @@ pf_purge_expired_src_nodes() pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) - cur->rule.ptr->rule_flag |= PFRULE_REFS; + cur->rule.ptr->rule_ref |= PFRULE_REFS; PF_HASHROW_UNLOCK(sh); } @@ -1783,11 +1783,11 @@ relock: pf_unlink_state(s, PF_ENTER_LOCKED); goto relock; } - s->rule.ptr->rule_flag |= PFRULE_REFS; + s->rule.ptr->rule_ref |= PFRULE_REFS; if (s->nat_rule.ptr != NULL) - s->nat_rule.ptr->rule_flag |= PFRULE_REFS; + s->nat_rule.ptr->rule_ref |= PFRULE_REFS; if (s->anchor.ptr != NULL) - s->anchor.ptr->rule_flag |= PFRULE_REFS; + s->anchor.ptr->rule_ref |= PFRULE_REFS; s->kif->pfik_flags |= PFI_IFLAG_REFS; if (s->rt_kif) s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; @@ -1839,11 +1839,11 @@ pf_purge_unlinked_rules() TAILQ_INIT(&tmpq); PF_UNLNKDRULES_LOCK(); TAILQ_FOREACH_SAFE(r, &V_pf_unlinked_rules, entries, r1) { - if (!(r->rule_flag & PFRULE_REFS)) { + if (!(r->rule_ref & PFRULE_REFS)) { TAILQ_REMOVE(&V_pf_unlinked_rules, r, entries); TAILQ_INSERT_TAIL(&tmpq, r, entries); } else - r->rule_flag &= ~PFRULE_REFS; + r->rule_ref &= ~PFRULE_REFS; } PF_UNLNKDRULES_UNLOCK(); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 152fa9dafca1..e7965b7dcecd 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -426,7 +426,7 @@ pf_unlink_rule(struct pf_krulequeue *rulequeue, struct pf_krule *rule) TAILQ_REMOVE(rulequeue, rule, entries); PF_UNLNKDRULES_LOCK(); - rule->rule_flag |= PFRULE_REFS; + rule->rule_ref |= PFRULE_REFS; TAILQ_INSERT_TAIL(&V_pf_unlinked_rules, rule, entries); PF_UNLNKDRULES_UNLOCK(); }