Patch "ping6: Fix send to link-local addresses with VRF." has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ping6: Fix send to link-local addresses with VRF.

to the 6.1-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:
     ping6-fix-send-to-link-local-addresses-with-vrf.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c8147d2ed42489e8f11ef145721cd7b2ae7b6ad9
Author: Guillaume Nault <gnault@xxxxxxxxxx>
Date:   Wed Jun 7 18:05:02 2023 +0200

    ping6: Fix send to link-local addresses with VRF.
    
    [ Upstream commit 91ffd1bae1dafbb9e34b46813f5b058581d9144d ]
    
    Ping sockets can't send packets when they're bound to a VRF master
    device and the output interface is set to a slave device.
    
    For example, when net.ipv4.ping_group_range is properly set, so that
    ping6 can use ping sockets, the following kind of commands fails:
      $ ip vrf exec red ping6 fe80::854:e7ff:fe88:4bf1%eth1
    
    What happens is that sk->sk_bound_dev_if is set to the VRF master
    device, but 'oif' is set to the real output device. Since both are set
    but different, ping_v6_sendmsg() sees their value as inconsistent and
    fails.
    
    Fix this by allowing 'oif' to be a slave device of ->sk_bound_dev_if.
    
    This fixes the following kselftest failure:
      $ ./fcnal-test.sh -t ipv6_ping
      [...]
      TEST: ping out, vrf device+address bind - ns-B IPv6 LLA        [FAIL]
    
    Reported-by: Mirsad Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
    Closes: https://lore.kernel.org/netdev/b6191f90-ffca-dbca-7d06-88a9788def9c@xxxxxxxxxxxx/
    Tested-by: Mirsad Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
    Fixes: 5e457896986e ("net: ipv6: Fix ping to link-local addresses.")
    Signed-off-by: Guillaume Nault <gnault@xxxxxxxxxx>
    Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/6c8b53108816a8d0d5705ae37bdc5a8322b5e3d9.1686153846.git.gnault@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 808983bc2ec9f..4651aaf70db4f 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -114,7 +114,8 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 	addr_type = ipv6_addr_type(daddr);
 	if ((__ipv6_addr_needs_scope_id(addr_type) && !oif) ||
 	    (addr_type & IPV6_ADDR_MAPPED) ||
-	    (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if))
+	    (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if &&
+	     l3mdev_master_ifindex_by_index(sock_net(sk), oif) != sk->sk_bound_dev_if))
 		return -EINVAL;
 
 	ipcm6_init_sk(&ipc6, np);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux