cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl /lib hostip.c

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Fri, 16 Apr 2004 20:31:33 +0200

"Daniel Stenberg" <bagder_at_php.net> said:

> /* 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 @@
>
> *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;
> +

What about the case when hostname is an IPv4/6 address?
We already have Curl_inet_pton() to check this with.

So if 'data->set.ip_version == CURL_IPRESOLVE_V6', and address
is an IPv4 address, should that be allowed? And vice-versa, if
'data->set.ip_version == CURL_IPRESOLVE_V4' and address is
is an IPv6 address (make an exception for V4 mapped or compatible
addresses maybe).

And if Curl_inet_pton() succeeded for either AF_INET/AF_INET6, should
there be any need to call getaddrinfo()? We could just make an 'in_addr' or
'in6_addr' to 'struct addrinfo' repacker. Do we really need 'ai_canonname'?
But the rest of the fields are given.

--gv
Received on 2004-04-16