ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

Preethi reported that PMTU discovery for UDP/raw applications is not
working in the presence of VRF when the socket is not bound to a device.
The problem is that ip6_sk_update_pmtu does not consider the L3 domain
of the skb device if the socket is not bound. Update the function to
set oif to the L3 master device if relevant.

Fixes: ca254490c8df ("net: Add VRF support to IPv6 stack")
Reported-by: Preethi Ramachandra <preethir@juniper.net>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Ahern and committed by
David S. Miller
7ddacfa5 1c1274a5

+5 -2
+5 -2
net/ipv6/route.c
··· 2359 2359 2360 2360 void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu) 2361 2361 { 2362 + int oif = sk->sk_bound_dev_if; 2362 2363 struct dst_entry *dst; 2363 2364 2364 - ip6_update_pmtu(skb, sock_net(sk), mtu, 2365 - sk->sk_bound_dev_if, sk->sk_mark, sk->sk_uid); 2365 + if (!oif && skb->dev) 2366 + oif = l3mdev_master_ifindex(skb->dev); 2367 + 2368 + ip6_update_pmtu(skb, sock_net(sk), mtu, oif, sk->sk_mark, sk->sk_uid); 2366 2369 2367 2370 dst = __sk_dst_get(sk); 2368 2371 if (!dst || !dst->obsolete ||