1 From foo@baz Fri 31 May 2019 03:48:00 PM PDT
2 From: Mike Manning <mmanning@vyatta.att-mail.com>
3 Date: Mon, 20 May 2019 19:57:17 +0100
4 Subject: ipv6: Consider sk_bound_dev_if when binding a raw socket to an address
6 From: Mike Manning <mmanning@vyatta.att-mail.com>
8 [ Upstream commit 72f7cfab6f93a8ea825fab8ccfb016d064269f7f ]
10 IPv6 does not consider if the socket is bound to a device when binding
11 to an address. The result is that a socket can be bound to eth0 and
12 then bound to the address of eth1. If the device is a VRF, the result
13 is that a socket can only be bound to an address in the default VRF.
15 Resolve by considering the device if sk_bound_dev_if is set.
17 Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
18 Reviewed-by: David Ahern <dsahern@gmail.com>
19 Tested-by: David Ahern <dsahern@gmail.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 1 file changed, 2 insertions(+)
28 @@ -283,7 +283,9 @@ static int rawv6_bind(struct sock *sk, s
29 /* Binding to link-local address requires an interface */
30 if (!sk->sk_bound_dev_if)
34 + if (sk->sk_bound_dev_if) {
36 dev = dev_get_by_index_rcu(sock_net(sk),