cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl /lib hostip.c

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 19 Apr 2004 09:39:36 +0200 (CEST)

On Fri, 16 Apr 2004, Gisle Vanem wrote:

> > + 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.

This check was added to a function that is only present for ipv4-only
machines. Asking for ipv6-only addresses on such a host will always fail. We
can be pretty sure of that! ;-)

> 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).

As the feature was once requested and how I saw a use for it, it would basicly
be used by ipv6-people who wants to make sure the connection uses the
ipv6-version of a host name's address. Or be sure that it uses the ipv4
version.

Then I can's see how ipv4-programs will ask for ipv6-addreses, and I can't see
how a host that is able to work with ipv6 addresses and requires (with
CURL_IPRESOLVE_V4) ipv4-addressed only, should be allowed to continue if it
doesn't get any.

This option should only be used if you REQUIRE a particular type of address,
and if no such address is available curl returns name resolve failure as it
can't fulfill the requirement.

> 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.

Yes, we should probably do that to avoid getaddrinfo() to get called for that
case in a similar fashion how we avoid it gethostbyname() to be called in
those cases.

> Do we really need 'ai_canonname'?

Uh, I'm not sure. It has been a while since we added that and I can't exactly
remember what made us do that (or even who did it! ;-)). I haven't seen it
break anything, have you?

IPv6 is such a untested and pioneering area that things don't always work as
supposed all over, why I feel bad about changing something that isn't truly
wrong by proof.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-19