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:			2cef62886d ("pf: convert state retrieval to netlink")
MFC after:		1 week
Sponsored by:		Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D60543
This commit is contained in:
R. Christian McDonald committed 2026-10-13 11:00:27 -04:00
1 parent 9664345efb
commit 74d2a0b79f
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -59,7 +59,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;
@@ -72,7 +72,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 },
+1 -1
View File
@@ -118,7 +118,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 */