]> 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>
Sun, 12 Feb 2017 22:26:06 +0000 (17:26 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Feb 2017 17:13:51 +0000 (12:13 -0500)
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>
net/ipv6/ip6_output.c

index b6a94ff0bbd0d5f42c78b7bcd6ea9fbe5ac9a595..e164684456df830c411781810f80e8e7c176d636 100644 (file)
@@ -1021,6 +1021,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;