aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-04-14 12:10:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-04-14 12:10:44 +0000
commit68e8a0f0d97ee36a355c74fc22bc6a9b3a821e3a (patch)
tree9dfd5caee2c946e76d4d6278e1b45650140e71d9 /lib/hostip.c
parentb23dbf9f3483cf7b8779399675f52704115de850 (diff)
asking for CURL_IPRESOLVE_V6 when ipv6 addresses can't be resolved will
now cause the resolve function to return NULL immediately
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 5e0312453..ccecf7267 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -761,6 +761,10 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
*waitp = FALSE;
+ if(data->set.ip_version == CURL_IPRESOLVE_V6)
+ /* an ipv6 address was requested and we can't get/use one */
+ return NULL;
+
bufp = strdup(hostname);
if(bufp) {
@@ -906,11 +910,17 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
/* see if we have an IPv6 stack */
s = socket(PF_INET6, SOCK_DGRAM, 0);
- if (s < 0)
+ if (s < 0) {
/* Some non-IPv6 stacks have been found to make very slow name resolves
* when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if
* the stack seems to be a non-ipv6 one. */
+
+ if(data->set.ip_version == CURL_IPRESOLVE_V6)
+ /* an ipv6 address was requested and we can't get/use one */
+ return NULL;
+
pf = PF_INET;
+ }
else {
/* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest
* possible checks. And close the socket again.
@@ -1120,6 +1130,10 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
*waitp = 0; /* don't wait, we act synchronously */
+ if(data->set.ip_version == CURL_IPRESOLVE_V6)
+ /* an ipv6 address was requested and we can't get/use one */
+ return NULL;
+
in=inet_addr(hostname);
if (in != CURL_INADDR_NONE) {
struct in_addr *addrentry;