git: e3773ad4716f - releng/14.0 - pf: try to lookup the icmp state based on a correct packet descriptor

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 19 Sep 2024 13:03:28 UTC
The branch releng/14.0 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e3773ad4716f975b8e8dc4e013bcb044278d8d27

commit e3773ad4716f975b8e8dc4e013bcb044278d8d27
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-08-26 14:42:05 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-09-19 12:58:34 +0000

    pf: try to lookup the icmp state based on a correct packet descriptor
    
    Approved by:    so
    Security:       FreeBSD-EN-24:16.pf
    MFC after:      1 week
    Obtained from:  OpenBSD, mikeb <mikeb@openbsd.org>, e467ea25dcd3
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit b8cd169efa6ac0899b4998898129765ae5c685a6)
    (cherry picked from commit f40b0e735177b25ce67fb488a93834168f4c16e1)
---
 sys/netpfil/pf/pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 7b501cc54b27..49bfefa2b6ed 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6709,11 +6709,11 @@ pf_test_state_icmp(struct pf_kstate **state, struct pfi_kkif *kif,
 			    pd->dir, kif, virtual_id, virtual_type,
 			    icmp_dir, &iidx, PF_ICMP_MULTI_NONE, 1);
 			if (ret >= 0) {
-				if (ret == PF_DROP && pd->af == AF_INET6 &&
+				if (ret == PF_DROP && pd2.af == AF_INET6 &&
 				    icmp_dir == PF_OUT) {
 					if (*state != NULL)
 						PF_STATE_UNLOCK((*state));
-					ret = pf_icmp_state_lookup(&key, pd,
+					ret = pf_icmp_state_lookup(&key, &pd2,
 					    state, m, off, pd->dir, kif,
 					    virtual_id, virtual_type,
 					    icmp_dir, &iidx, multi, 1);