git: 54b034b928c0 - stable/15 - pf: Parse the GETSTATES state id as 64 bits

From: R. Christian McDonald <rcm_at_FreeBSD.org>
Date: Wed, 28 Oct 2026 20:35:56 UTC
The branch stable/15 has been updated by rcm:

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

commit 54b034b928c0e997dea20778fe39293118826b7a
Author:     R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-10-13 14:53:10 +0000
Commit:     R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-10-28 20:34:14 +0000

    pf: Parse the GETSTATES state id as 64 bits
    
    The GETSTATES dump sends PF_ST_ID as a u64, but the request parser
    reads it as a u32 and rejects an id taken from the dump with EINVAL.
    Nothing in base sends PF_ST_ID.  Parse and document it as a u64.
    
    Reviewed by:            kp
    Fixes:                  2cef62886dc7 ("pf: convert state retrieval to netlink")
    MFC after:              1 week
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D60543
    
    (cherry picked from commit 74d2a0b79ffd8d43da61eaca36b39935594d8772)
---
 sys/netpfil/pf/pf_nl.c | 4 ++--
 sys/netpfil/pf/pf_nl.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 4c33fbd7bc37..cbfeb628f765 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -56,7 +56,7 @@ static bool nlattr_add_pf_threshold(struct nl_writer *, int,
 
 struct nl_parsed_state {
 	uint8_t		version;
-	uint32_t	id;
+	uint64_t	id;
 	uint32_t	creatorid;
 	char		ifname[IFNAMSIZ];
 	uint16_t	proto;
@@ -68,7 +68,7 @@ struct nl_parsed_state {
 #define	_IN(_field)	offsetof(struct genlmsghdr, _field)
 #define	_OUT(_field)	offsetof(struct nl_parsed_state, _field)
 static const struct nlattr_parser nla_p_state[] = {
-	{ .type = PF_ST_ID, .off = _OUT(id), .cb = nlattr_get_uint32 },
+	{ .type = PF_ST_ID, .off = _OUT(id), .cb = nlattr_get_uint64 },
 	{ .type = PF_ST_CREATORID, .off = _OUT(creatorid), .cb = nlattr_get_uint32 },
 	{ .type = PF_ST_IFNAME, .arg = (const void *)IFNAMSIZ, .off = _OUT(ifname), .cb = nlattr_get_chara },
 	{ .type = PF_ST_AF, .off = _OUT(af), .cb = nlattr_get_uint8 },
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index b60d3d4797c6..e06731726998 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -100,7 +100,7 @@ enum pfstate_peer_type_t {
 
 enum pfstate_type_t {
 	PF_ST_UNSPEC,
-	PF_ST_ID		= 1, /* u32, state id */
+	PF_ST_ID		= 1, /* u64, state id */
 	PF_ST_CREATORID		= 2, /* u32, */
 	PF_ST_IFNAME		= 3, /* string */
 	PF_ST_ORIG_IFNAME	= 4, /* string */