summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJonathan T. Leighton <jtleight@udel.edu>2017-05-24 01:53:34 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-17 04:41:49 (GMT)
commitcb351da6f2badf45d87cf0d21826d81a77f5e433 (patch)
tree5bceb0a4f157357e9375b8f24310effc2344c328 /net
parent12ec2560d467812424ff8eb6f7fccc83f64aae3d (diff)
downloadlinux-cb351da6f2badf45d87cf0d21826d81a77f5e433.tar.xz
ipv6: Inhibit IPv4-mapped src address on the wire.
[ 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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ip6_output.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1ac3cea..3ab32ac 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1019,6 +1019,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;