Re: [PATCH net-next v2] ipv4: igmp: report IFA_TARGET_NETNSID in multicast address dumps

From: Nicolas Dichtel

Date: Fri Nov 13 2026 - 14:27:29 EST


Le 12/11/2026 à 09:23, Wenbo Sun a écrit :
> Commit eb4e17a1d915 ("netlink: support dumping IPv4 multicast addresses")
> extended RTM_GETMULTICAST to dump IPv4 multicast addresses by reusing
> inet_valid_dump_ifaddr_req(), which already accepts IFA_TARGET_NETNSID
> and switches to the target network namespace. However,
> inet_fill_ifmcaddr() does not include IFA_TARGET_NETNSID in the dump
> replies yet.
>
> In contrast, IPv4 unicast dumps (inet_fill_ifaddr()), IPv6 multicast
> dumps (inet6_fill_ifmcaddr()), and AF_PACKET multicast dumps
> (dev_mc_fill_addr()) all report IFA_TARGET_NETNSID when a netns id is
> specified. Adding the same behavior to IPv4 multicast dumps aligns
> reporting across address families and helps userspace consistently
> identify target-netns replies.
>
> Emit IFA_TARGET_NETNSID in inet_fill_ifmcaddr() when args->netnsid >= 0,
> and initialize fillargs.netnsid = -1 in inet_ifmcaddr_notify() so that
> multicast join/leave notifications do not include IFA_TARGET_NETNSID or
> exceed their preallocated skb size.
>
> This alignment was identified with the assistance of an LLM-based code
> review tool, confirmed in a User-Mode Linux (UML) environment where AF_INET
> RTM_GETMULTICAST dumps with IFA_TARGET_NETNSID omitted the attribute while
> AF_INET6 included it, and verified in UML that AF_INET multicast dumps
> now report IFA_TARGET_NETNSID, regular dumps without netnsid continue to
> work, and multicast join/leave notifications succeed without warning.
>
> Signed-off-by: Wenbo Sun <sunwenbo@xxxxxxxxxxxxxxxxxxxx>

Reviewed-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>