]> git.baikalelectronics.ru Git - kernel.git/commit
nh: fix scope used to find saddr when adding non gw nh
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Thu, 20 Oct 2022 10:09:52 +0000 (12:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:56:56 +0000 (23:56 +0900)
commitae8413385ff431454f84e38409eca48918d6aeeb
tree401647b3beb696733ebc534585524affe3f0a211
parent0057c6dbe695240e74819e863cde8750f7299ab8
nh: fix scope used to find saddr when adding non gw nh

[ Upstream commit 5d05be61553a381573a4cb48b9cf4a005763bacd ]

As explained by Julian, fib_nh_scope is related to fib_nh_gw4, but
fib_info_update_nhc_saddr() needs the scope of the route, which is
the scope "before" fib_nh_scope, ie fib_nh_scope - 1.

This patch fixes the problem described in commit 7c0d80225cc9 ("ip: fix
dflt addr selection for connected nexthop").

Fixes: 0b2837f003c1 ("nexthop: Add support for IPv4 nexthops")
Link: https://lore.kernel.org/netdev/6c8a44ba-c2d5-cdf-c5c7-5baf97cba38@ssi.bg/
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/nexthop.c