🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14798

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

#14798
From: Hangbin Liu
Date: Thu, 12 Nov 2026 00:47
70 lines
11173 bytes
On Wed, Nov 11, 2026 at 04:22:22PM +0800, Wenbo Sun wrote:
> Commit eb4e17a1d915 ("netlink: support dumping IPv4 multicast addresses")
> extended RTM_GETMULTICAST to support dumping IPv4 multicast addresses.
> While inet_valid_dump_ifaddr_req() accepts IFA_TARGET_NETNSID in dump
> requests and dumps addresses from the target network namespace,
> inet_fill_ifmcaddr() never puts IFA_TARGET_NETNSID in the netlink
> replies.
> 
> As a result, userspace applications querying multicast addresses in a
> target netns receive entries without IFA_TARGET_NETNSID, which may lead
> them to conclude that the kernel does not support netns-targeted dumps
> or to misattribute the returned addresses. In contrast, IPv4 unicast
> address dumps (inet_fill_ifaddr()), IPv6 multicast address dumps
> (inet6_fill_ifmcaddr()), and AF_PACKET multicast address dumps all
> report IFA_TARGET_NETNSID.
> 
> Add IFA_TARGET_NETNSID to inet_fill_ifmcaddr() when requested, and
> explicitly set fillargs.netnsid = -1 in inet_ifmcaddr_notify() to
> prevent notification messages from exceeding their preallocated skb
> size.
> 
> This issue was identified with the assistance of an LLM-based code
> review tool, confirmed by reproducing in a User-Mode Linux (UML)
> environment where AF_INET RTM_GETMULTICAST dumps with IFA_TARGET_NETNSID
> omitted the attribute, and verified in UML that AF_INET multicast dumps
> now report IFA_TARGET_NETNSID, normal dumps without netnsid continue to
> work, and socket multicast join/leave notifications succeed without
> warning.
> 
> Fixes: eb4e17a1d915 ("netlink: support dumping IPv4 multicast addresses")

I don't think this should be fix. Maybe consider this as a new feature and
target to net-next?

Thanks
Hangbin
> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
> ---
>  net/ipv4/igmp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
> index 144fca158adc..831d003677ba 100644
> --- a/net/ipv4/igmp.c
> +++ b/net/ipv4/igmp.c
> @@ -1517,6 +1517,12 @@ int inet_fill_ifmcaddr(struct sk_buff *skb, struct net_device *dev,
>  	ifm->ifa_scope = RT_SCOPE_UNIVERSE;
>  	ifm->ifa_index = dev->ifindex;
>  
> +	if (args->netnsid >= 0 &&
> +	    nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) {
> +		nlmsg_cancel(skb, nlh);
> +		return -EMSGSIZE;
> +	}
> +
>  	ci.cstamp = (READ_ONCE(im->mca_cstamp) - INITIAL_JIFFIES) * 100UL / HZ;
>  	ci.tstamp = ci.cstamp;
>  	ci.ifa_prefered = INFINITY_LIFE_TIME;
> @@ -1538,6 +1544,7 @@ static void inet_ifmcaddr_notify(struct net_device *dev,
>  {
>  	struct inet_fill_args fillargs = {
>  		.event = event,
> +		.netnsid = -1,
>  	};
>  	struct net *net = dev_net(dev);
>  	struct sk_buff *skb;
> -- 
> 2.33.0
> 
Technical Details
Message-ID: <avUMkYmCtkwNYf8_@fedora>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361406-linux-kernel-netdev=dewy.ru
References: <20261111082222.327963-1-sunwenbo@cmss.chinamobile.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361406-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] ipv4: igmp: report IFA_TARGET_NETNSID in multicast
 address dumps
Date: Thu, 12 Nov 2026 08:47:13 +0800
Organization: Usenet Network
Message-ID: <avUMkYmCtkwNYf8_@fedora>
References: <20261111082222.327963-1-sunwenbo@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="975916"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mw2CjywSGB1Adv4W0moWF+d/Ft0= sha256:nUNl0K2xi4g21Zat4CREMTkgkIu35nDQ8OlymwwjASI=
	sha1:9MdWX8guLEFpS1jIqeNnZXBFAZE= sha256:CFA3bM69EL6KtHfzzhfXzKdkxuSoyt2r60fzEJu6mQQ=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9332811409B; Thu, 12 Nov 2026 03:50:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Mg5LiB27Krck;
	Thu, 12 Nov 2026 03:50:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-361406-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 7A7AA113FAE; Thu, 12 Nov 2026 03:50:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id D224F624B9A; Thu, 12 Nov 2026 00:48:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794444447;
	b=CtcJCFm/ACIg7Nfc1yr4DDoSr9BMwtrEuSfIfdHfj89KohZddw3ocJ6wUFUifRg+EjCL
	 iDkovwe9Imrj74JFrg08MlJNqnyzWF9rauHjtO3FLFiYPzqwhYsOFx+wSAjOe8U7Ue9n7
	 e4IQxKSFQmhCMg91n8josswl8q2vfZT1kwJI00G394HQ0XVcge9u7SL9mjBzYPY/+dFUb
	 iXjttts2tynqcbHDzxXGl244Qd/8ljkaPo4g3/IyerYsKIXCjmFKGbDfg7rXm9Is69LAj
	 /yWBX/T7ABNr1wPCrBwnydjkSq/ywRUIkqfvL00wbiF7mLElFhVgrltEx/3s0LOfGqQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794444447;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=/meX34FFjvsBjwEFSiF7h2pMrlZOIlpgdM74rS/8GJs=;
	b=nCvM2R/cuP9Fzem02l2hxLZimA4alkOst6vAYB341WctMutjCE3fCur8omytloKMrjsg
	 rdkYww2Dp4KMkcIqpErGcLtDKvBZciY25Ur/nP2/2kEofrBEDJydi+3txWJsr8MT9ZGgU
	 YmIsH4nRdq6wsYezWve+VMOzUJ7gmP94+W0NKTSWZUIh9pRHKJaW7WQDZBC7nqAQmJzmK
	 DikUGLGjAWCVoxiYOyZj48zau2CE9UrhsCWVXPkBZmurle7X0angcY5e+ZiwFdDBdZw1h
	 22spoJK9R6g2CeJ3M+mPWEx24ag7BbZbP5C4mpljaU7PihS5T5iRD9lSHfGuotWcDkg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=c5tECsEz;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 35BBC60A3827;
	Thu, 12 Nov 2026 00:47:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=c5tECsEz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.198
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794444446;
	b=OQuf0B65Opj89rHsY75qy6mE5QhYPgLragJkC5vSbVbpbxOu3qy7xUtqDGzQ2wHkLD40
	 JZf7hwD6EMzclJvSSGEElYNP3kKY1hrXGlDNHGFo++D9tdsVdqtJSLMx3EJIeI3W7VVPA
	 aczw8kNim8F8UYrnoXo/7Pu2kbwfG0ypg0dhCJ3xMgN+eBOM0AejISIYpJz5fRIBRza5b
	 L1sLE/1Cb4fm52guQ42ri5VUSdtZ62OvyajF/1Tlx7fiqCoD1BNe2AtDi3vf4raAqgpdn
	 SL23ShF1vK4a9PuTA6B/nQg+Breb322/gizCJGL53A6bqGwYY0DlALjdUBy737Sa0rg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794444446;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=/meX34FFjvsBjwEFSiF7h2pMrlZOIlpgdM74rS/8GJs=;
	b=YG2/ptvJhsE6hdzSGSG/dg84kJIZ03xCkWa5NRyinZrdQFLMzwUjUvCnu8KyC6iRzg+b
	 uga08JHpUMwuuGDkAwTg3xZtSnnGsT9ldj/OEVfxWyxTSyHUibH/Q3kus8+mqFYFExs10
	 ZZ9MikE8UKPzhuoJlsWxozWiU2QVwIhdsk00UZ1dlwVCM+LKjxX8JWyDbqPdikIgsAe/l
	 pJZYqv7J9XEr6Jv+EbOdJsxtmxuNbi7zK0LWSMxhJJ6rI2CXsk6q1oEPp+2M9dOoLVqp+
	 /weoaHBLgI6PnC23CJftyh3NzghGVmkrJec2Jzlw+SwY87wkLga1SZypppESsik1TQA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=c5tECsEz;
	arc=none smtp.remote-ip=95.215.58.198
X-Received: from mta1.migadu.com (out-198.mta1.migadu.com [95.215.58.198])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4364660A3823
	for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 00:47:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4364660A3823
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=fMSPfR8xyIbF4ge2e/H/gRNwNJPj7Dk9rRNiQdhWwhY=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1794444443; v=1; x=1795049243;
 b=c5tECsEzcVpY0zNvO3yky12+P2vnJ9u9wB+JEUAUgXq9umTxM7Q2GY9Q0Irv+lFRohwQOLB9
 ww9lzmfDlag+xxB+sr/SWygRH2ulL3R0seuVpN9rJ/YGhDnrKtLYrHvPcjIWPyHOtzSmiUez3a0
 P+XmAYdfetd8/8xz3wwVFNhM=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta12.migadu.com with ESMTPS id a465595a3c07692d;
	Thu, 12 Nov 2026 00:47:23 +0000
X-Mizu-Trace-ID: a465595a3c07692d
X-Migadu-Flow: FLOW_OUT
X-Cc: David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Yuyang Huang <yuyanghuang@google.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, 1342116488@qq.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261111082222.327963-1-sunwenbo@cmss.chinamobile.com>