Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tim Menninger" <tmenninger@everpuredata.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection
Date: Fri, 04 Dec 2026 23:49:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-250815@kernel.org> (raw)
In-Reply-To: <20261203234720.2428689-2-tmenninger@everpuredata.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ipv6: ip6_route_get_saddr() uses wrong device on local
  multipath routes
--

commit 32b20a077341b7e5f5d4b5cc3861087c45ef1ebf
Author: Tim Menninger <tmenninger@everpuredata.com>

ipv6: Use the selected nexthop for source address selection

This commit passes the selected dst_entry to ip6_route_get_saddr() so
that IPv6 source address selection uses the chosen path's device when
a route references a multipath nexthop group.

> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 95f936be32c6c..d5754f6442bbf 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h

[ ... ]

> @@ -155,8 +156,12 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
>  	rcu_read_lock();
>  
>  	l3mdev = dev_get_by_index_rcu(net, l3mdev_index);
> -	if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev)
> -		dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
> +	if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) {
> +		if (dst && f6i && f6i->nh && nexthop_is_multipath(f6i->nh))
> +			dev = dst_dev_rcu(dst);
> +		else
> +			dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
> +	}
>  	same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev;
>  	if (f6i && f6i->fib6_prefsrc.plen && same_vrf)
>  		*saddr = f6i->fib6_prefsrc.addr;

[Severity: Medium]
Can dst_dev_rcu(dst) return loopback_dev or a VRF master instead of the
selected nexthop device here?

Userspace can install an RTN_LOCAL route referencing a multipath nexthop
group via RTA_NH_ID.  For RTF_LOCAL and RTF_ANYCAST routes,
ip6_rt_get_dev_rcu() overrides dst->dev to loopback_dev (or the VRF
master for non-strict VRF slave destinations).

Passing loopback_dev to ipv6_dev_get_saddr() fails with -EADDRNOTAVAIL
for link-local destinations, and prefers loopback over the nexthop
interface for global ones.  In a VRF, l3mdev_master_dev_rcu(dev) ==
l3mdev also fails, ignoring even an explicit f6i->fib6_prefsrc.

Excluding routes with RTF_LOCAL or RTF_ANYCAST set (or using
rt6i_idev->dev) would avoid selecting the wrong device.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203234720.2428689-1-tmenninger@everpuredata.com?part=1

  reply	other threads:[~2026-12-04 23:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 23:47 [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths Tim Menninger
2026-12-03 23:47 ` [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Tim Menninger
2026-12-04 23:49   ` sashiko-bot [this message]
2026-12-03 23:47 ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address Tim Menninger
2026-12-04 23:49   ` sashiko-bot
2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger
2026-12-04 23:49 ` [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths sashiko-bot

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=sashiko-outbox-250815@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tmenninger@everpuredata.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox