Article View: linux.kernel.netdev
Article #27192Re: [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:37
Date: Sat, 05 Dec 2026 00:37
89 lines
11243 bytes
11243 bytes
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
Technical Details
Message-ID:
<179643104797.3146.10807230740872201020@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377767-linux-kernel-netdev=dewy.ruReferences:
<20261203234720.2428689-2-tmenninger@everpuredata.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377767-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Date: Sat, 05 Dec 2026 00:37:27 +0000 Organization: Usenet Network Message-ID: <179643104797.3146.10807230740872201020@kernel.org> References: <20261203234720.2428689-2-tmenninger@everpuredata.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2917178"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:CeLkf24iM3O5tJAfIZVhsLs1ZYk= sha256:jY4hFMXlnCkruvRkavXi0LR+n1BkC3GDQfrbqQB6MTY= sha1:PIG3yID6hDmy9zfOluK/EP40kS4= sha256:KuDV1oB/DEXD0akeRC2WQvB6eR4A08Tiz8IKot/3aQ8= 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 A6C95117D35; Sat, 5 Dec 2026 03:37:54 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.542 X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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] 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 CcoiS5vbUD77; Sat, 5 Dec 2026 03:37:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377767-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 321F1117D32; Sat, 5 Dec 2026 03:37:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id EBB6539E49; Sat, 5 Dec 2026 00:37:31 +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=1796431050; b=TUHOzV27adTjqXKzyXjp6Tu1dp+va5sKjBkcR/QIB7t1APoQ9uAma8v9YukCTF3AnEJg GxTgb9TbPSgmXDSiSUCO0HgQSh+uaJVkXSWXrnQ0pM7nX/nC5fOAjj0Y+K9gp7ueXy/fV H3FvmmdgPzc5KBtIzeyrKsNNquDMC6DSdxaVyDp3TJLNflG94Ys/VxsTPrC9ld/WCNZSf qc7NIaJlPc6y5+hflD9rg5Gbz1WLx1htrzp7sWKAQFQmKGjTJ7FZKJ3gh28fBLbeCqZSg LuSUsQPFw8U3ex7OqV+bz9I2F0UCRTAxl3I/Coz+M23eTgIrwKklWiFl4R8w/t/0ihw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796431050; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=+xwjewBGbK1dCS/cp2Ssupilg3o4AHRGn51mIXv06zo=; b=TG1ka3DBwQJz2IbipFp3TjLVps3hpZQ8LHJ0I6JoEhlrZbhNvkjGZ4scYWJZadkSGJzp 4vD6p2kgxwb4kfefXitw9ag/VEm5Zeum5wqDonNp1SU88pvbsSKeibMt4OT5maF/Sul86 F/xa14/1KcxtDObvF2rvSUXPOMq0kppqHZrqqnjeLncRZy4WUCo9Q50bpkYv6ZVJu4xWZ HTEg8wxv+r7/qOAUip/fbJBDaAI4rqRH5UeXMot222iddcQ//LLUdb7Xk1uc+qIh0NPzQ V/fzTrkkNjkGOAG2J77sC2cRihPJNh1wUQrMfw14Bw0ApA+QdGnTk/LiZtFlaFwTasA== 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=UI0w9yZ+; 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 BA76F606A680; Sat, 5 Dec 2026 00:37:30 +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=UI0w9yZ+ 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=1796431049; b=3TRsn5GsQ/GTvFoILC2OGg4om7/ZionUl5oed1t/o70n7H/gqP1jX6QIYS5lYJM2aTEa zPw22UTtgfkyiwx+YbryBfrVrhD3C6f8GmHaDPcMtuaXMOWv6pm1u1JxAN2he9IgFbilj rOZZXEnS+z7EL7ZaVz6eaG0M1gJRb8Md+ffTLMRVup8QZnkqQLGW/wxTzHgj3sWE5Rner 6fd87TgF2c6xVCa4gJqOzX70kieeC1bC+1IDWRjOITIpqwyFc5KcdN0RrF7JcmDfFF4pQ yhrEDVqC6oje/e/+TsO5OEyX9IbQwJ+LjptyKqyYsLINOOmnUq3Zuh6sn19p8fv6qsQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796431049; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=+xwjewBGbK1dCS/cp2Ssupilg3o4AHRGn51mIXv06zo=; b=IadtmMnuhAOhLCHLRvM4N4dHzQdjOvKP+UTzkrySRxUgtGyBz+5GVTpTy8ST0DKbfhF+ tz9k0G/z8ygC2nc5mr3VjqizQxwFyqxsjNFP7OGioDO0h5M5R/q2A/vJyqf4qS9tgCBnE aeJI1ZM5d+bNCZzluFtgjdlAGrhF0tPbN2thuNHL5TlFYdjQ4qSoN+pvvkeikXr02Dm0c a+1BwG+Bg8EDGEBX55Loa+GrofTfkJ33s0Eb/bCEzCfukqzkeXSlP/4EpBLxolhngpsgR SytFWbFAbXixr+86Lh8fNmldfl3R0zP95s8sNaJ1lJ1wmoBVmlKxss4gb6uFnWnJ2mw== 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=UI0w9yZ+; 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 D6CC8606A322; Sat, 5 Dec 2026 00:37:29 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 703821F0092B; Sat, 5 Dec 2026 00:37:28 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796431049; bh=+xwjewBGbK1dCS/cp2Ssupilg3o4AHRGn51mIXv06zo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=UI0w9yZ+8BP3SkLnGF6YXRKBh/DCr+cmoi0jo+FfB3XzgNlI1sOGtkwHSBeNLgY5f tYKncIgEoYG88oOXYglahiVi1ShGCtawPv2ikeXgyG4f6lX9TrhuKPVg1Kv/4ZSQxv fl7J6HHYetTbvaS26lzEx90BD7VmxJnH0OY/d/PW2RfmVgWQZIZW02syCGsU+zO8Yp pvnmXMQH4LVCDHfL9fIbcUJ8J9GA/3BbTRoY8naaVKhl31VIQOokQws75oJJKViZ73 YmYw8g4y94ut45cowp69U0+zPXtC75VGk8x+yysX9ks4slF4jNdjraTSR7lTZa9nz+ 3dTDOei2zSg0A== X-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 X-In-Reply-To: <20261203234720.2428689-2-tmenninger@everpuredata.com> X-sashiko-severity: Low 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