git: 74d2a0b79ffd - main - pf: Parse the GETSTATES state id as 64 bits
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Oct 2026 15:09:05 UTC
The branch main has been updated by rcm:
URL: https://cgit.FreeBSD.org/src/commit/?id=74d2a0b79ffd8d43da61eaca36b39935594d8772
commit 74d2a0b79ffd8d43da61eaca36b39935594d8772
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-13 15:00:27 +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
---
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 3ddd2308a318..d35545bbfe32 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -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 },
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index c3c8da3571d3..d7adad2e8bd6 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -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 */