git: 01482de9585a - main - libsysdecode: decode PFNL_CMD_GET_RULESETS and PFNL_CMD_GET_RULESET

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 26 Aug 2026 15:39:20 UTC
The branch main has been updated by kp:

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

commit 01482de9585abd4d14e3f61eb8af6d60f685cbe9
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-08-26 15:03:18 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-08-26 15:03:59 +0000

    libsysdecode: decode PFNL_CMD_GET_RULESETS and PFNL_CMD_GET_RULESET
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 lib/libsysdecode/netlink.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/libsysdecode/netlink.c b/lib/libsysdecode/netlink.c
index e2b49ea12d7c..5a7021b7b22b 100644
--- a/lib/libsysdecode/netlink.c
+++ b/lib/libsysdecode/netlink.c
@@ -341,6 +341,12 @@ static const struct nlattr_decoder nla_d_clear_states[] = {
 };
 NL_DECLARE_ATTR_DECODER(killclear_states_decoder, nla_d_clear_states);
 
+static const struct nlattr_decoder nla_d_ruleset[] = {
+	{ .type = PF_RS_PATH, .attr_name = "path", .cb = nlattr_decode_string },
+	{ .type = PF_RS_NR, .attr_name = "nr", .cb = nlattr_decode_uint32 },
+};
+NL_DECLARE_ATTR_DECODER(ruleset_decoder, nla_d_ruleset);
+
 static inline void
 nl_verify_decoders(const struct nlattr_decoder_set **decoder, size_t count)
 {
@@ -361,6 +367,7 @@ static const struct nlattr_decoder_set *all_decoders[] = {
 	&addr_decoder,
 	&rule_addr_decoder,
 	&killclear_states_decoder,
+	&ruleset_decoder,
 };
 
 static const struct pfnl_cmd_decoder cmd_decoder[] = {
@@ -369,6 +376,8 @@ static const struct pfnl_cmd_decoder cmd_decoder[] = {
 	{ .cmd_num = PFNL_CMD_GET_LIMIT, .ds = &set_limit_decoder },
 	{ .cmd_num = PFNL_CMD_GET_ADDRS, .ds = &addr_decoder },
 	{ .cmd_num = PFNL_CMD_GET_ADDR, .ds = &addr_decoder },
+	{ .cmd_num = PFNL_CMD_GET_RULESETS, .ds = &ruleset_decoder },
+	{ .cmd_num = PFNL_CMD_GET_RULESET, .ds = &ruleset_decoder },
 };
 
 static inline void