* [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS
@ 2025-04-02 12:17 Fernando Fernandez Mancera
2025-04-02 14:25 ` Simon Horman
2025-04-03 22:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Fernando Fernandez Mancera @ 2025-04-02 12:17 UTC (permalink / raw)
To: netdev; +Cc: dsahern, edumazet, kuba, pabeni, horms,
Fernando Fernandez Mancera
Using RTEXT_FILTER_SKIP_STATS is incorrectly skipping non-stats IPv6
netlink attributes on link dump. This causes issues on userspace tools,
e.g iproute2 is not rendering address generation mode as it should due
to missing netlink attribute.
Move the filling of IFLA_INET6_STATS and IFLA_INET6_ICMP6STATS to a
helper function guarded by a flag check to avoid hitting the same
situation in the future.
Fixes: d5566fd72ec1 ("rtnetlink: RTEXT_FILTER_SKIP_STATS support to avoid dumping inet/inet6 stats")
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
net/ipv6/addrconf.c | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ac8cc1076536..54a8ea004da2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5784,6 +5784,27 @@ static void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype,
}
}
+static int inet6_fill_ifla6_stats_attrs(struct sk_buff *skb,
+ struct inet6_dev *idev)
+{
+ struct nlattr *nla;
+
+ nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
+ if (!nla)
+ goto nla_put_failure;
+ snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
+
+ nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
+ if (!nla)
+ goto nla_put_failure;
+ snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
+
+ return 0;
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev,
u32 ext_filter_mask)
{
@@ -5806,18 +5827,10 @@ static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev,
/* XXX - MC not implemented */
- if (ext_filter_mask & RTEXT_FILTER_SKIP_STATS)
- return 0;
-
- nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
- if (!nla)
- goto nla_put_failure;
- snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
-
- nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
- if (!nla)
- goto nla_put_failure;
- snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
+ if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS)) {
+ if (inet6_fill_ifla6_stats_attrs(skb, idev) < 0)
+ goto nla_put_failure;
+ }
nla = nla_reserve(skb, IFLA_INET6_TOKEN, sizeof(struct in6_addr));
if (!nla)
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS
2025-04-02 12:17 [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS Fernando Fernandez Mancera
@ 2025-04-02 14:25 ` Simon Horman
2025-04-03 22:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-04-02 14:25 UTC (permalink / raw)
To: Fernando Fernandez Mancera; +Cc: netdev, dsahern, edumazet, kuba, pabeni
On Wed, Apr 02, 2025 at 02:17:51PM +0200, Fernando Fernandez Mancera wrote:
> Using RTEXT_FILTER_SKIP_STATS is incorrectly skipping non-stats IPv6
> netlink attributes on link dump. This causes issues on userspace tools,
> e.g iproute2 is not rendering address generation mode as it should due
> to missing netlink attribute.
>
> Move the filling of IFLA_INET6_STATS and IFLA_INET6_ICMP6STATS to a
> helper function guarded by a flag check to avoid hitting the same
> situation in the future.
>
> Fixes: d5566fd72ec1 ("rtnetlink: RTEXT_FILTER_SKIP_STATS support to avoid dumping inet/inet6 stats")
> Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS
2025-04-02 12:17 [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS Fernando Fernandez Mancera
2025-04-02 14:25 ` Simon Horman
@ 2025-04-03 22:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-03 22:20 UTC (permalink / raw)
To: Fernando Fernandez Mancera; +Cc: netdev, dsahern, edumazet, kuba, pabeni, horms
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 2 Apr 2025 14:17:51 +0200 you wrote:
> Using RTEXT_FILTER_SKIP_STATS is incorrectly skipping non-stats IPv6
> netlink attributes on link dump. This causes issues on userspace tools,
> e.g iproute2 is not rendering address generation mode as it should due
> to missing netlink attribute.
>
> Move the filling of IFLA_INET6_STATS and IFLA_INET6_ICMP6STATS to a
> helper function guarded by a flag check to avoid hitting the same
> situation in the future.
>
> [...]
Here is the summary with links:
- [net,v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS
https://git.kernel.org/netdev/net/c/7ac6ea4a3e08
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-03 22:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 12:17 [PATCH net v2] ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS Fernando Fernandez Mancera
2025-04-02 14:25 ` Simon Horman
2025-04-03 22:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).