]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
ipv6: Inhibit IPv4-mapped src address on the wire.
authorJonathan T. Leighton <jtleight@udel.edu>
Wed, 24 May 2017 01:53:34 +0000 (21:53 -0400)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 27 Jun 2017 13:16:34 +0000 (10:16 -0300)
BugLink: http://bugs.launchpad.net/bugs/1698817
[ Upstream commit ec5e3b0a1d41fbda0cc33a45bc9e54e91d9d12c7 ]

This patch adds a check for the problematic case of an IPv4-mapped IPv6
source address and a destination address that is neither an IPv4-mapped
IPv6 address nor in6addr_any, and returns an appropriate error. The
check in done before returning from looking up the route.

Signed-off-by: Jonathan T. Leighton <jtleight@udel.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
net/ipv6/ip6_output.c

index 1db17efe36c18f2980dbf867dc9ee4bef8efb863..19c0d67ce8c4d8025bfac316539b40e780ff5c3c 100644 (file)
@@ -1004,6 +1004,9 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk,
                }
        }
 #endif
+       if (ipv6_addr_v4mapped(&fl6->saddr) &&
+           !(ipv6_addr_v4mapped(&fl6->daddr) || ipv6_addr_any(&fl6->daddr)))
+               return -EAFNOSUPPORT;
 
        return 0;