Le 03/08/2024 à 16:55, Sasha Levin a écrit :
This is a note to let you know that I've just added the patch titled
ipv4: fix source address selection with route leak
to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: ipv4-fix-source-address-selection-with-route-leak.patch and it can be found in the queue-5.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
I'm not sure I fully understand the process, but Greg already sent a mail because this patch doesn't compile on the 5.15 stable branch.
I sent a backport: https://lore.kernel.org/stable/20240802085305.2749750-1-nicolas.dichtel@6win...
Regards, Nicolas
commit dfd009372d960dc1ccf694e7369d58e63cd133c4 Author: Nicolas Dichtel nicolas.dichtel@6wind.com Date: Wed Jul 10 10:14:27 2024 +0200
ipv4: fix source address selection with route leak
[ Upstream commit 6807352353561187a718e87204458999dbcbba1b ] By default, an address assigned to the output interface is selected when the source address is not specified. This is problematic when a route, configured in a vrf, uses an interface from another vrf (aka route leak). The original vrf does not own the selected source address. Let's add a check against the output interface and call the appropriate function to select the source address. CC: stable@vger.kernel.org Fixes: 8cbb512c923d ("net: Add source address lookup op for VRF") Signed-off-by: Nicolas Dichtel nicolas.dichtel@6wind.com Reviewed-by: David Ahern dsahern@kernel.org Link: https://patch.msgid.link/20240710081521.3809742-2-nicolas.dichtel@6wind.com Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 3d00253afbb8d..4f1236458c214 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -2286,6 +2286,15 @@ void fib_select_path(struct net *net, struct fib_result *res, fib_select_default(fl4, res); check_saddr:
- if (!fl4->saddr)
fl4->saddr = fib_result_prefsrc(net, res);
- if (!fl4->saddr) {
struct net_device *l3mdev;
l3mdev = dev_get_by_index_rcu(net, fl4->flowi4_l3mdev);
if (!l3mdev ||
l3mdev_master_dev_rcu(FIB_RES_DEV(*res)) == l3mdev)
fl4->saddr = fib_result_prefsrc(net, res);
else
fl4->saddr = inet_select_addr(l3mdev, 0, RT_SCOPE_LINK);
- }
}