* [nft PATCH] mnl: Support NFNL_HOOK_TYPE_NFT_FLOWTABLE
@ 2025-07-08 13:04 Phil Sutter
2025-07-08 13:48 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2025-07-08 13:04 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Florian Westphal, netfilter-devel
New kernels dump info for flowtable hooks the same way as for base
chains.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
include/linux/netfilter/nfnetlink_hook.h | 2 ++
src/mnl.c | 12 ++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/netfilter/nfnetlink_hook.h b/include/linux/netfilter/nfnetlink_hook.h
index 84a561a74b982..1a2c4d6424b5f 100644
--- a/include/linux/netfilter/nfnetlink_hook.h
+++ b/include/linux/netfilter/nfnetlink_hook.h
@@ -61,10 +61,12 @@ enum nfnl_hook_chain_desc_attributes {
*
* @NFNL_HOOK_TYPE_NFTABLES: nf_tables base chain
* @NFNL_HOOK_TYPE_BPF: bpf program
+ * @NFNL_HOOK_TYPE_NFT_FLOWTABLE: nf_tables flowtable
*/
enum nfnl_hook_chaintype {
NFNL_HOOK_TYPE_NFTABLES = 0x1,
NFNL_HOOK_TYPE_BPF,
+ NFNL_HOOK_TYPE_NFT_FLOWTABLE,
};
/**
diff --git a/src/mnl.c b/src/mnl.c
index 33269ffebbbf6..3713fe3b3a745 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -48,6 +48,7 @@ struct basehook {
const char *table;
const char *chain;
const char *devname;
+ const char *objtype;
int family;
int chain_family;
uint32_t num;
@@ -2453,7 +2454,8 @@ static int dump_nf_hooks(const struct nlmsghdr *nlh, void *_data)
}
type = ntohl(mnl_attr_get_u32(nested[NFNLA_HOOK_INFO_TYPE]));
- if (type == NFNL_HOOK_TYPE_NFTABLES) {
+ if (type == NFNL_HOOK_TYPE_NFTABLES ||
+ type == NFNL_HOOK_TYPE_NFT_FLOWTABLE) {
struct nlattr *info[NFNLA_CHAIN_MAX + 1] = {};
const char *tablename, *chainname;
@@ -2471,6 +2473,10 @@ static int dump_nf_hooks(const struct nlmsghdr *nlh, void *_data)
hook->chain = xstrdup(chainname);
}
hook->chain_family = mnl_attr_get_u8(info[NFNLA_CHAIN_FAMILY]);
+ if (type == NFNL_HOOK_TYPE_NFT_FLOWTABLE)
+ hook->objtype = "flowtable";
+ else
+ hook->objtype = "chain";
} else if (type == NFNL_HOOK_TYPE_BPF) {
struct nlattr *info[NFNLA_HOOK_BPF_MAX + 1] = {};
@@ -2594,7 +2600,9 @@ static void print_hooks(struct netlink_ctx *ctx, int family, struct list_head *h
fprintf(fp, "\t\t+%010u", prio);
if (hook->table && hook->chain)
- fprintf(fp, " chain %s %s %s", family2str(hook->chain_family), hook->table, hook->chain);
+ fprintf(fp, " %s %s %s %s",
+ hook->objtype, family2str(hook->chain_family),
+ hook->table, hook->chain);
else if (hook->hookfn && hook->chain)
fprintf(fp, " %s %s", hook->hookfn, hook->chain);
else if (hook->hookfn) {
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-15 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 13:04 [nft PATCH] mnl: Support NFNL_HOOK_TYPE_NFT_FLOWTABLE Phil Sutter
2025-07-08 13:48 ` Florian Westphal
2025-07-15 15:08 ` Phil Sutter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.