Skip to content

Commit c45c624

Browse files
CKI Backport BotHangbin Liu
authored andcommitted
ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS
JIRA: https://issues.redhat.com/browse/RHEL-96599 commit 7ac6ea4 Author: Fernando Fernandez Mancera <ffmancera@riseup.net> Date: Wed Apr 2 14:17:51 2025 +0200 ipv6: fix omitted netlink attributes when using RTEXT_FILTER_SKIP_STATS 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: d5566fd ("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> Link: https://patch.msgid.link/20250402121751.3108-1-ffmancera@riseup.net Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent 5fc1e78 commit c45c624

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

net/ipv6/addrconf.c

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5798,6 +5798,27 @@ static void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype,
57985798
}
57995799
}
58005800

5801+
static int inet6_fill_ifla6_stats_attrs(struct sk_buff *skb,
5802+
struct inet6_dev *idev)
5803+
{
5804+
struct nlattr *nla;
5805+
5806+
nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
5807+
if (!nla)
5808+
goto nla_put_failure;
5809+
snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
5810+
5811+
nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
5812+
if (!nla)
5813+
goto nla_put_failure;
5814+
snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
5815+
5816+
return 0;
5817+
5818+
nla_put_failure:
5819+
return -EMSGSIZE;
5820+
}
5821+
58015822
static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev,
58025823
u32 ext_filter_mask)
58035824
{
@@ -5820,18 +5841,10 @@ static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev,
58205841

58215842
/* XXX - MC not implemented */
58225843

5823-
if (ext_filter_mask & RTEXT_FILTER_SKIP_STATS)
5824-
return 0;
5825-
5826-
nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
5827-
if (!nla)
5828-
goto nla_put_failure;
5829-
snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
5830-
5831-
nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
5832-
if (!nla)
5833-
goto nla_put_failure;
5834-
snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
5844+
if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS)) {
5845+
if (inet6_fill_ifla6_stats_attrs(skb, idev) < 0)
5846+
goto nla_put_failure;
5847+
}
58355848

58365849
nla = nla_reserve(skb, IFLA_INET6_TOKEN, sizeof(struct in6_addr));
58375850
if (!nla)

0 commit comments

Comments
 (0)