diff options
| author | Ishan Agrawal <iagrawal9990@gmail.com> | 2026-08-08 05:55:56 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2026-08-10 14:33:32 +0000 |
| commit | 11bc53984b1ffd298978b5c48188a010fb34572b (patch) | |
| tree | a5840ee31ef742a98b932a1a6e516fc0a1ada5a7 | |
| parent | 91aa9bf0ae169fafe4c5ec8578d28733d2fab85c (diff) | |
libsysdecode: add attribute parsing for PFNL_CMD_GETRULES
Signed-off-by: Ishan Agrawal <iagrawal9990@gmail.com>
Sponsored-by: Google LLC (GSoC 2026)
Reviewed by: kp
| -rw-r--r-- | lib/libsysdecode/netlink.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libsysdecode/netlink.c b/lib/libsysdecode/netlink.c index b8c657b1b4e1..344822f18fcb 100644 --- a/lib/libsysdecode/netlink.c +++ b/lib/libsysdecode/netlink.c @@ -237,6 +237,15 @@ nl_decode_attrs_raw(FILE *fp, const struct nlattr *nla_head, size_t len, fprintf(fp, "}"); } +static const struct nlattr_decoder nla_d_getrules[] = { + { .type = PF_GR_ANCHOR, .attr_name = "anchor", .cb = nlattr_decode_string }, + { .type = PF_GR_ACTION, .attr_name = "action", .cb = nlattr_decode_uint8 }, + { .type = PF_GR_NR, .attr_name = "nr", .cb = nlattr_decode_uint32 }, + { .type = PF_GR_TICKET, .attr_name = "ticket", .cb = nlattr_decode_uint32 }, + { .type = PF_GR_CLEAR, .attr_name = "clear", .cb = nlattr_decode_uint8 }, +}; +NL_DECLARE_ATTR_DECODER(getrules_decoder, nla_d_getrules); + static const struct nlattr_decoder nla_d_set_limit[] = { { .type = PF_LI_INDEX, .attr_name = "index", .cb = nlattr_decode_uint32 }, { .type = PF_LI_LIMIT, .attr_name = "limit", .cb = nlattr_decode_uint32 }, @@ -313,6 +322,10 @@ sysdecode_netlink_pf(FILE *fp, const struct genlmsghdr *genl, size_t nlm_len) ((const char *)genl + sizeof(struct genlmsghdr)); switch (cmd) { + case PFNL_CMD_GETRULES: + nl_decode_attrs_raw(fp, nla, nlm_len, + getrules_decoder.decoders, getrules_decoder.count); + break; case PFNL_CMD_GET_LIMIT: nl_decode_attrs_raw(fp, nla, nlm_len, set_limit_decoder.decoders, set_limit_decoder.count); |
