summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2009-08-18 16:14:33 -0700
committerLorenzo Colitti <lorenzo@google.com>2009-08-18 16:29:42 -0700
commit723edb3d255972ca93314a580e7a8bcb0a0ee2d5 (patch)
treebba440e36cf9ec9c641ac059d8624d14d33343a2
parent3abb0161b285c422fe50d54cdfa248f0aefd65e5 (diff)
downloadlibcore-723edb3d255972ca93314a580e7a8bcb0a0ee2d5.zip
libcore-723edb3d255972ca93314a580e7a8bcb0a0ee2d5.tar.gz
libcore-723edb3d255972ca93314a580e7a8bcb0a0ee2d5.tar.bz2
Enable IPv6.
If the system has IPv6 connectivity, query the DNS for IPv6 addresses as well as IPv4 addresses. If IPv6 addresses are returned, prefer them by default. Impact of this change: - If the device is on a network with IPv6 configured, is using wifi, and has obtained an IPv6 address using autoconfiguration, the network stack will request IPv6 addresses as well as IPv4 addresses when making DNS queries. This allows the device to connect to websites and services that declare themselves to be reachable over IPv6. If an IPv6 connection fails, the stack will fall back to IPv4. This is what Windows Vista, Mac OS 10.4 and above, and most Linux distributions do by default. - If the device is not on a network that supports IPv6, or is using 3G/EVDO, nothing will change. I have been testing this change on self-compiled builds of master and eclair on Dream and Sholes for several weeks with no breakage that I can see.
-rw-r--r--luni/src/main/native/java_net_InetAddress.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/luni/src/main/native/java_net_InetAddress.cpp b/luni/src/main/native/java_net_InetAddress.cpp
index 508656f..8724817 100644
--- a/luni/src/main/native/java_net_InetAddress.cpp
+++ b/luni/src/main/native/java_net_InetAddress.cpp
@@ -116,7 +116,8 @@ static jobjectArray getAllByNameUsingDns(JNIEnv* env, const char* name,
* resolver will create two separate requests, one for IPv4 and one,
* currently unnecessary, for IPv6.
*/
- hints.ai_family = AF_INET;
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_flags = AI_ADDRCONFIG;
/*
* If we don't specify a socket type, every address will appear twice, once
* for SOCK_STREAM and one for SOCK_DGRAM. Since we do not return the family