From: netdev-bot+sashiko@kernel.org
To: tmenninger@everpuredata.com
Cc: leon@kernel.org, jgg@ziepe.ca, bharat@chelsio.com,
dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, shuah@kernel.org, slingappa@everpuredata.com,
rpatil@everpuredata.com, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection
Date: Sat, 05 Dec 2026 00:37:27 +0000 [thread overview]
Message-ID: <179643104797.3146.10807230740872201020@kernel.org> (raw)
In-Reply-To: <20261203234720.2428689-2-tmenninger@everpuredata.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In ip6_route_get_saddr() (include/net/ip6_route.h), the new
branch treats dst->dev as the device of the selected nexthop whenever…
--
ipv6: Use the selected nexthop for source address selection
This commit passes the dst to ip6_route_get_saddr(). For routes that use
a multipath nexthop group, the source address is then picked for the
device of the path the lookup selected, not for the group's first
nexthop. Both ip6_dst_lookup_tail() and rt6_fill_node() are updated to
pass the dst.
> 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);
[Severity: Low]
Is dst->dev always the device of the selected nexthop here?
For routes with RTF_LOCAL or RTF_ANYCAST set, ip6_rt_pcpu_alloc() and
ip6_rt_cache_alloc() build their clones with a device from
ip6_rt_get_dev_rcu(), and that function replaces the nexthop device:
net/ipv6/route.c:ip6_rt_get_dev_rcu() {
struct net_device *dev = res->nh->fib_nh_dev;
if (res->fib6_flags & (RTF_LOCAL | RTF_ANYCAST)) {
...
if (netif_is_l3_slave(dev) &&
!rt6_need_strict(&res->f6i->fib6_dst.addr))
dev = l3mdev_master_dev_rcu(dev) ? :
dev_net(dev)->loopback_dev;
else if (!netif_is_l3_master(dev))
dev = dev_net(dev)->loopback_dev;
}
...
}
It looks like such a route can be created with RTN_LOCAL and an
RTA_NH_ID that points at a multipath group. rtm_to_fib6_config() sets
RTF_LOCAL, and fib6_check_nexthop() only rejects source routing, IPv4
nexthops and FDB nexthops.
For that route, ip6_dst_lookup_tail() and rt6_fill_node() would now pass
loopback or the VRF master to ipv6_dev_get_saddr(). Neither is the device
of any nexthop in the group. Local routes with a single nexthop, or with
no nexthop object, still get the real nexthop device from
fib6_info_nh_dev().
For link-local or multicast destinations, or when use_oif_addrs_only is
set, only the addresses of the device passed in are considered. Could
this return ::1 or no usable address? In other cases, the rule 4
(outgoing interface) and VRF master preference would change.
Should the new branch skip routes that have RTF_LOCAL or RTF_ANYCAST in
f6i->fib6_flags?
> + 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;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203234720.2428689-1-tmenninger%40everpuredata.com
next prev parent reply other threads:[~2026-12-05 0:37 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-05 0:37 ` netdev-bot+sashiko [this message]
2026-12-03 23:47 ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address Tim Menninger
2026-12-05 0:37 ` netdev-bot+sashiko
2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger
2026-12-05 0:37 ` netdev-bot+sashiko
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=179643104797.3146.10807230740872201020@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=bharat@chelsio.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rpatil@everpuredata.com \
--cc=shuah@kernel.org \
--cc=slingappa@everpuredata.com \
--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