🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19104

Re: [PATCH net 1/1] ipv6: mcast: use resolved interface for source filters

#19104
From: Simon Horman
Date: Thu, 19 Nov 2026 10:42
57 lines
9926 bytes
On Thu, Nov 12, 2026 at 03:19:04PM +0000, Zihan Xi wrote:
> When no interface is specified, ip6_mc_source() resolves the multicast
> route to an interface but searches socket memberships with a wildcard
> index. A socket joined to the same group on multiple interfaces can
> therefore update its source filter on a different interface from the
> interface filter.
> 
> Use the resolved interface index for the membership lookup and for
> dropping the membership after leaving the last source.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

Hi Zihan,

I see that Paolo has responded, and his comments should stand.
But I had been looking into this patch and I think it's worth
sharing two points, in case they turn out to be useful in future.

There is an AI-generated review of this patch available at
https://sashiko.dev/#/patchset/cover.1794738094.git.zihanx%40nebusec.ai

It states:

  Furthermore, the duplicate membership check with ifindex == 0 in
  ipv6_sock_mc_join(), the -EADDRINUSE handling in MCAST_JOIN_SOURCE_GROUP,
  and the leavegroup handling in ip6_mc_source() were introduced later by
  c9e3e8b6958e ("[IPV6]: multicast join and misc"), while
  ipv6_sock_mc_join_ssm() was introduced by c7ea20c9da5b ("ipv6/mcast: init
  as INCLUDE when join SSM INCLUDE group").  Should the Fixes: tag point to
  those commits instead?

I would lean towards using c9e3e8b6958e as the Fixes tag as it seems to me
that is the commit that that first introduced this bug.

> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
> ---
>  net/ipv6/mcast.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index ecef55f26189..63770b3a7bb2 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -362,6 +362,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
>  	struct net *net = sock_net(sk);
>  	struct ipv6_mc_socklist *pmc;
>  	struct inet6_dev *idev;
> +	int ifindex;
>  	int leavegroup = 0;
>  	int i, j;
>  	int err;

For reference, please preserve reverse xmas tree - longest line to shortest -
ordering for local variable declarations in Networking code.
Technical Details
Message-ID: <20261119104230.GT860048@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366952-linux-kernel-netdev=dewy.ru
References: <cover.1794492711.git.zihanx@nebusec.ai> <a5d3d0505baed01a213ea7953f0fe78cb025ee22.1794492711.git.zihanx@nebusec.ai>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366952-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/1] ipv6: mcast: use resolved interface for source
 filters
Date: Thu, 19 Nov 2026 10:42:30 +0000
Organization: Usenet Network
Message-ID: <20261119104230.GT860048@horms.kernel.org>
References: <cover.1794492711.git.zihanx@nebusec.ai>
 <a5d3d0505baed01a213ea7953f0fe78cb025ee22.1794492711.git.zihanx@nebusec.ai>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2851273"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qQnrtAVpY8DcEJcFnM0b6wMDGqY= sha256:Jxrq0wSjdkmt9CEZMEn8Z/HoNktKgbsGKsrEuHkGUJg=
	sha1:ar6FzEOLvDPyHbtpoa8+B8QmxIM= sha256:Jvh22QZBcbvzrmCv0rFNLQjolrHOWcfs17WS0M/GMNU=
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 1CE4B1155C4; Thu, 19 Nov 2026 13:42:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 VP7PWlHaDc2J;
	Thu, 19 Nov 2026 13:42:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366952-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id E3CD811556D; Thu, 19 Nov 2026 13:42:37 +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 EFEDA726AAC; Thu, 19 Nov 2026 10:42:36 +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=1795084956;
	b=D26HDL5wrCS0CdXxOojkn9+ivBrZ6fmcdkjlVGMVxzZ2wppabgYDT0r3uD34IHdQfLD5
	 B4mjIf8TH0AY2FliXwUSy9vU+/mNCkiFnKF1rHFjg91ttuqiOk0/MfvCIEZRZEL4cqjud
	 3/vg/2B/N66yuebApGNDBzJvbZGZUBUlcaE5JzgbYN/RZygjhrwMt33NELy5SIHw5kdsk
	 S0eC0PCEPofV5BlLBmgGQGfg1a1RofpAP5zpNxPZQwzqwnhE0Ziy/Dcp2DRmDKO5jb64O
	 2LbkEKNbLxUneh+mHs9MCoCxTR3zgbSXrmwYLHRUcuPhxuhlLe32fJYxO34AHHpDAYQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795084956;
	h=X-Original-To:Received:Received:DKIM-Signature: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=QnXZokuDLYMZLjJ6ee2/Ob0NQxuJ0RZGSiWoiYV2gM0=;
	b=YTjiPXPgoIEPt5BNxinsaTgF1jndlATM1dPOE2jdgCkI9qRsuURZPB2NOIbxhSrpV8nF
	 giITHPs1xJZaVKJ9V66h5UCVzj027kHei2PBtvvx6DwohW4w8pIIQ4Z0bGfGYJtcuSH5a
	 26xjRyhyOvndmSzR852MxRqFO6IrL8Fve1snlV6oJfAe01fOXpfa7x1JUrLjHGEsFLjya
	 AfZVuMdzgy/am6uN3vfGRjx/AgX2FI//O+5o2ILiiLKNmhh6mv1nnPV7DuH+NiNmf003c
	 +Ds0RJv8m0GM8jiGpG0hdJEcItewSKE9pzsVdysV8UJqGKigUGNbwohYsucI3mKhOlA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMoFhX2N;
	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 15C2260A2605;
	Thu, 19 Nov 2026 10:42:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMoFhX2N
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795084955;
	b=yXZzS6Re55XWSydRKMP/yBkbiOlGkE5tMaND2QWiR2Egf43FCvLGJcGW55M7IoRKQ+CO
	 3uYUx+CxZANjzWjJ43K8SfsR23qkHxKle2dAtt4fxC5josq+7E+ddR2Yktr0xPU6d2N+o
	 iZFhQG9hR9qRfMkYg9Np54UvhwU134eWCt2HjCn/TBYj/SuyOxGaM5vsPPCtH5A9K7oVD
	 ksZnEiqjdavG1wYUGo0CwT81G36YTgmx0QD8O9SZjWunVTJUluOFloesSRIQaKpDTSf8r
	 eLll3HNCQ3oG1Dc1VlSOCymm8c9CBl5+Kf2b7nMDaXtJT0fLTrD/e7x7AlP558ZPBEA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795084955;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=QnXZokuDLYMZLjJ6ee2/Ob0NQxuJ0RZGSiWoiYV2gM0=;
	b=Mv5J5UvkV8LkvVdIiw/XtF5lWsfy23nCtTRW+PMLJg5hDihYekSNAQrWTLxpfgvS51l2
	 YMQm0XXh8v0B9FWcdhOpA1sLmTNDt/TKQBtcCRBhrBecs3hFSGgAWp34fZ2xJ5zZnNung
	 CO1RNylew/EUJrmQ6Ft1sRrCw13CM41idHaZ5kmc2bZWJXWz33rYqSqb/kYuhfP+G2SKp
	 DmFWaUFZTdOtDRPj2gip2A9scpLj8PP3m/MFNdILH+WUSl1IiGlZT3nzQ4mePsgK4ocja
	 lEG4nDrBozDyQ4qC5NjxhBWAS9LJsexKstnm6mUi4UQab+aB71oy6NnwRmozxidT49g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMoFhX2N;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 367A5606A33D
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 10:42:34 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EA1E1F000C7;
	Thu, 19 Nov 2026 10:42:33 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795084954;
	bh=QnXZokuDLYMZLjJ6ee2/Ob0NQxuJ0RZGSiWoiYV2gM0=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=KMoFhX2NYyv25GWPIeMdUiSkPOw5kFii2OemDLZYHC8eAlTo5+fHWzu9c0UJTShwr
	 Km7T9ojV5xEP4cHSCIi2DeFu4E0Q0B1vPn7XCmH1yFhjMpiA7vYKS1nNyGR4sFJv8H
	 9Lex/k8Yrx2T4ArCYAvhJNNznrTS3VvWrgWuizp8e6uLaoOZ/1qg/D4vb4nCUSSj5z
	 KjhZz+vsbAB1P4v6whalbSONQJuFqEe5Dg0ESDDognloLLsqgctXjhfs92vAoE54pF
	 rWA4RrIGHh4EfJ8peu2buub/njqKKMjnnvWIkNGwGqlKdZLpcIrnx/T8/KaVcpHqq6
	 WqkxKbW5sFnyQ==
X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
	vega@nebusec.ai
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: <a5d3d0505baed01a213ea7953f0fe78cb025ee22.1794492711.git.zihanx@nebusec.ai>