Skip to contentSkip to conversation

Patch "ipv4: fix source address selection with route leak" has been added to the 5.15-stable tree

DISCUSSION Nicolas Dichtel 2 participants 4 messages Aug 5, 2024 – Aug 6, 2024 1 message not in the archive Stable branch

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Le 03/08/2024 à 16:55, Sasha Levin a écrit :

Quoted 7 lines

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;a=summary

Quoted 6 lines

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 <[email protected]> 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/[email protected]/

Regards,
Nicolas

Quoted 49 lines

commit dfd009372d960dc1ccf694e7369d58e63cd133c4

Author: Nicolas Dichtel <[email protected]>
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.

net/ipv4/fib_semantics.c +11 -2
index 3d00253afbb8d..4f1236458c214 100644
@@ -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);
+	}
 }
maintainer
#2 lore raw
Quoted 12 lines · Nicolas Dichtel

Le 03/08/2024 à 16:55, Sasha Levin a écrit :

Quoted 11 lines

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;a=summary

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.

Quoted 7 lines
Quoted 2 lines

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> 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/[email protected]/

Appologies, I haven't seen your backport, but instead I've picked up 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") as a dependency to address the build failure.

Signature · 2 lines
Thanks,
Sasha
#3 lore raw

Le 05/08/2024 à 13:24, Sasha Levin a écrit :

Quoted 19 lines · Nicolas Dichtel
Quoted 18 lines

Le 03/08/2024 à 16:55, Sasha Levin a écrit :

Quoted 8 lines

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;a=summary

Quoted 6 lines

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 <[email protected]> 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.

Quoted 7 lines
Quoted 2 lines

I sent a backport:
https://lore.kernel.org/stable/[email protected]/

Appologies, I haven't seen your backport, but instead I've picked up 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") as a dependency to address the build failure.

No problem, it's fine for me. I will launch the selftests to check the backport. I've just sent another backport for the last patch of the series.

https://lore.kernel.org/stable/2024072906-causation-conceal-2567@gregkh/T/#m7065a276c15cc43e31b92b49465a6e6c6b85d7a2

author Tested-by
#4 lore raw

Le 05/08/2024 à 14:56, Nicolas Dichtel a écrit :

Quoted 20 lines

Le 05/08/2024 à 13:24, Sasha Levin a écrit :

Quoted 19 lines · Nicolas Dichtel
Quoted 18 lines

Le 03/08/2024 à 16:55, Sasha Levin a écrit :

Quoted 8 lines

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;a=summary

Quoted 6 lines

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 <[email protected]> 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.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I sent a backport:
https://lore.kernel.org/stable/[email protected]/

Appologies, I haven't seen your backport, but instead I've picked up 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") as a dependency to address the build failure.

No problem, it's fine for me. I will launch the selftests to check the backport.