git: 129e15d49943 - main - ipfw: fix bpf tap point lookup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Dec 2025 02:23:51 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=129e15d4994311958db59a1718d4ff42d440ce2b
commit 129e15d4994311958db59a1718d4ff42d440ce2b
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-12-22 01:18:27 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
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);