aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2024-08-26 14:44:20 +0000
committerKristof Provost <kp@FreeBSD.org>2024-09-04 08:53:06 +0000
commitb4b8b2fc9bd25d10eab0afdbd06a7ef8735b7b6b (patch)
tree80abcc1435b9b68f92e863e8929f339abbba5fe0
parentfa4b64836183c33631d92dadb073a9e435c5bf6d (diff)
pf: be less strict about icmp state checking for sloppy state tracking
Sloppy state tracking renders ICMP direction check useless and harmful as we might see only half of the connection in the asymmetric setups but ignore the state match. The bug was reported and fix was verified by Insan Praja <insan () ims-solusi ! com>. Thanks! OK mcbride, henning MFC after: 1 week Obtained from: OpenBSD, mikeb <mikeb@openbsd.org>, 538596657140 Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 3da3eb6081a2e2f6ea2fed1728d5dd7f9e8786e5)
-rw-r--r--sys/netpfil/pf/pf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index ef6a2bd7de40..db7d8659baec 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6098,6 +6098,9 @@ pf_icmp_state_lookup(struct pf_state_key_cmp *key, struct pf_pdesc *pd,
STATE_LOOKUP(kif, key, direction, *state, pd);
+ if ((*state)->state_flags & PFSTATE_SLOPPY)
+ return (-1);
+
/* Is this ICMP message flowing in right direction? */
if ((*state)->rule.ptr->type &&
(((!inner && (*state)->direction == direction) ||