summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-01-09 18:31:34 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2025-01-19 16:41:53 +0100
commit880ccec0d02efb24900f589d0cac826af1d91523 (patch)
tree34fd0f71e4d56d70d2303d4fd61b2ae6cd05fcf7 /net
parentb7c2d793c28cda7dbb67d6b427e3280b7c1e601a (diff)
downloadlinux-880ccec0d02efb24900f589d0cac826af1d91523.tar.gz
linux-880ccec0d02efb24900f589d0cac826af1d91523.tar.bz2
linux-880ccec0d02efb24900f589d0cac826af1d91523.zip
netfilter: nf_tables: Use stored ifname in netdev hook dumps
The stored ifname and ops.dev->name may deviate after creation due to interface name changes. Prefer the more deterministic stored name in dumps which also helps avoiding inadvertent changes to stored ruleset dumps. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_tables_api.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 95d8d33589b1..87175cd1d39b 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1956,15 +1956,16 @@ static int nft_dump_basechain_hook(struct sk_buff *skb,
if (!first)
first = hook;
- if (nla_put_string(skb, NFTA_DEVICE_NAME,
- hook->ops.dev->name))
+ if (nla_put(skb, NFTA_DEVICE_NAME,
+ hook->ifnamelen, hook->ifname))
goto nla_put_failure;
n++;
}
nla_nest_end(skb, nest_devs);
if (n == 1 &&
- nla_put_string(skb, NFTA_HOOK_DEV, first->ops.dev->name))
+ nla_put(skb, NFTA_HOOK_DEV,
+ first->ifnamelen, first->ifname))
goto nla_put_failure;
}
nla_nest_end(skb, nest);
@@ -9324,7 +9325,8 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net,
list_for_each_entry_rcu(hook, hook_list, list,
lockdep_commit_lock_is_held(net)) {
- if (nla_put_string(skb, NFTA_DEVICE_NAME, hook->ops.dev->name))
+ if (nla_put(skb, NFTA_DEVICE_NAME,
+ hook->ifnamelen, hook->ifname))
goto nla_put_failure;
}
nla_nest_end(skb, nest_devs);