All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Zihan Xi <zihanx@nebusec.ai>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
	vega@nebusec.ai
Subject: Re: [PATCH net 1/1] ipv6: mcast: use resolved interface for source filters
Date: Thu, 19 Nov 2026 10:42:30 +0000	[thread overview]
Message-ID: <20261119104230.GT860048@horms.kernel.org> (raw)
In-Reply-To: <a5d3d0505baed01a213ea7953f0fe78cb025ee22.1794492711.git.zihanx@nebusec.ai>

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.

      parent reply	other threads:[~2026-11-19 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 15:19 [PATCH net 0/1] ipv6: mcast: fix default-interface source filter selection Zihan Xi
2026-11-12 15:19 ` [PATCH net 1/1] ipv6: mcast: use resolved interface for source filters Zihan Xi
2026-11-19  8:39   ` Paolo Abeni
2026-11-19  8:43   ` Paolo Abeni
2026-11-19 10:42   ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119104230.GT860048@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vega@nebusec.ai \
    --cc=zihanx@nebusec.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.