summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuyang Huang <sigefriedhyy@gmail.com>2026-06-30 20:02:06 +0900
committerPaolo Abeni <pabeni@redhat.com>2026-07-03 08:50:44 +0200
commite1d0f3f0839103bc5387d2fa78eb1fd9af2d1fe1 (patch)
treeda95f6e0c82facf388b2b91c54be60bdfa2a2c36
parent7cb8198761e627ff3a3b4770c8f147e75c4e649d (diff)
downloadlinux-stable-e1d0f3f0839103bc5387d2fa78eb1fd9af2d1fe1.tar.gz
linux-stable-e1d0f3f0839103bc5387d2fa78eb1fd9af2d1fe1.zip
net: ipv6: report multicast group user count
The previous patch added IFA_MC_USERS and emits it for IPv4 multicast groups. Add the same snapshot attribute to IPv6 RTM_GETMULTICAST replies and entry-lifecycle notifications, carrying ifmcaddr6::mca_users. This makes the multicast rtnetlink ABI symmetric across IPv4 and IPv6 and gives userspace the same user count that /proc/net/igmp6 exposes. Signed-off-by: Yuyang Huang <sigefriedhyy@gmail.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260630110207.37841-3-sigefriedhyy@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--net/ipv6/addrconf.c1
-rw-r--r--net/ipv6/mcast.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index cbe681de3818..f1fe9ede1edb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5264,6 +5264,7 @@ int inet6_fill_ifmcaddr(struct sk_buff *skb,
put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
if (nla_put_in6_addr(skb, IFA_MULTICAST, &ifmca->mca_addr) < 0 ||
+ nla_put_u32(skb, IFA_MC_USERS, READ_ONCE(ifmca->mca_users)) < 0 ||
put_cacheinfo(skb, ifmca->mca_cstamp, READ_ONCE(ifmca->mca_tstamp),
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) {
nlmsg_cancel(skb, nlh);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 04b811b3be97..774f4c72a6fa 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -908,6 +908,7 @@ static void inet6_ifmcaddr_notify(struct net_device *dev,
skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct ifaddrmsg)) +
nla_total_size(sizeof(struct in6_addr)) +
+ nla_total_size(sizeof(u32)) +
nla_total_size(sizeof(struct ifa_cacheinfo)),
GFP_KERNEL);
if (!skb)