From 8ace8303d0e056ea56c2f782b3575a79d78dcb92 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Mon, 4 Sep 2017 14:57:08 +0800 Subject: [PATCH] ipv6: ip6_output: fix for Android 7.1 CTS After commit 23287661af3e ("ipv6: Inhibit IPv4-mapped src address on the wire.") Android failed to pass DatagramSocketTest#test_getRemoteSocketAddress: fail: java.net.ConnectException: Address family not supported by protocol Android side has patch "Fix DatagramSocketTest#test_getRemoteSocketAddress". Unfortunately, which may not merge to Android 7.1 branch, so we have to fixes it on kernel side. Change-Id: I7444c7636f02485abf6ddd4d7b9cad1f4e6d06e1 Signed-off-by: Tao Huang --- net/ipv6/ip6_output.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index eed9231c90ad..8553788ce65b 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -58,6 +58,7 @@ #include #include #include +#include static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb) { @@ -1025,11 +1026,14 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk, } } #endif +#if defined(CONFIG_ANDROID_VERSION) && CONFIG_ANDROID_VERSION < ANDROID_VERSION(8, 0, 0, 0) +#else if (ipv6_addr_v4mapped(&fl6->saddr) && !(ipv6_addr_v4mapped(&fl6->daddr) || ipv6_addr_any(&fl6->daddr))) { err = -EAFNOSUPPORT; goto out_err_release; } +#endif return 0;