diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2016-06-07 18:11:37 +0800 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-06-07 20:39:05 +0200 |
commit | 01a49a7626ee4a226cd0b50d70591ab147d60ee0 (patch) | |
tree | ef54a49ff290e8c432570d6dc081ebb6c56f420d /lib/asyn-thread.c | |
parent | 9b6d3a662ea81ec3bbb12002ca79fd27d750671e (diff) | |
download | curl-01a49a7626ee4a226cd0b50d70591ab147d60ee0.tar.gz |
resolve: add support for IPv6 DNS64/NAT64 Networks on OS X + iOS
Use getaddrinfo() to resolve the IPv4 address literal on iOS/Mac OS X.
If the current network interface doesn’t support IPv4, but supports
IPv6, NAT64, and DNS64.
Closes #866
Fixes #863
Diffstat (limited to 'lib/asyn-thread.c')
-rw-r--r-- | lib/asyn-thread.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 81caedb09..0ca260334 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -279,6 +279,9 @@ static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg) if(tsd->sock_error == 0) tsd->sock_error = RESOLVER_ENOMEM; } + else { + Curl_addrinfo_set_port(tsd->res, tsd->port); + } Curl_mutex_acquire(tsd->mtx); if(tsd->done) { @@ -602,6 +605,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn, *waitp = 0; /* default to synchronous response */ +#ifndef USE_RESOLVE_ON_IPS /* First check if this is an IPv4 address string */ if(Curl_inet_pton(AF_INET, hostname, &in) > 0) /* This is a dotted IP address 123.123.123.123-style */ @@ -609,7 +613,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn, #ifdef CURLRES_IPV6 /* check if this is an IPv6 address string */ - if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0) + if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) /* This is an IPv6 address literal */ return Curl_ip2addr(AF_INET6, &in6, hostname, port); @@ -633,6 +637,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn, pf = PF_INET; #endif /* CURLRES_IPV6 */ +#endif /* USE_RESOLVE_ON_IPS */ memset(&hints, 0, sizeof(hints)); hints.ai_family = pf; @@ -656,6 +661,10 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn, hostname, port, Curl_strerror(conn, SOCKERRNO)); return NULL; } + else { + Curl_addrinfo_set_port(res, port); + } + return res; } |