ev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 129e15d4994311958db59a1718d4ff42d440ce2b Auto-Submitted: auto-generated Date: Mon, 22 Dec 2025 02:23:51 +0000 Message-Id: <6948abb7.37f05.2a08a421@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=129e15d4994311958db59a1718d4ff42d440ce2b commit 129e15d4994311958db59a1718d4ff42d440ce2b Author: Gleb Smirnoff AuthorDate: 2025-12-22 01:18:27 +0000 Commit: Gleb Smirnoff CommitDate: 2025-12-22 02:23:14 +0000 ipfw: fix bpf tap point lookup The trick I blindly used works for pointers to structs, but not for rule numbers that can differ only by 1. PR: 291854 Fixes: 3daae1ac1d82ecdcd855101bab5206e914b12350 --- sys/netpfil/ipfw/ip_fw_bpf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw_bpf.c b/sys/netpfil/ipfw/ip_fw_bpf.c index aa92d30007c2..d9897f700d57 100644 --- a/sys/netpfil/ipfw/ip_fw_bpf.c +++ b/sys/netpfil/ipfw/ip_fw_bpf.c @@ -63,10 +63,10 @@ struct ipfw_tap { char name[sizeof("ipfw4294967295")]; }; -static int32_t +static inline int tap_compare(const struct ipfw_tap *a, const struct ipfw_tap *b) { - return ((int32_t)(a->rule/2 - b->rule/2)); + return (a->rule != b->rule ? (a->rule < b->rule ? -1 : 1) : 0); } RB_HEAD(tap_tree, ipfw_tap); VNET_DEFINE_STATIC(struct tap_tree, tap_tree);