cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_IPRESOLVE

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 14 Apr 2004 17:03:51 +0200 (CEST)

On Wed, 14 Apr 2004, Gisle Vanem wrote:

> > Aha, you meant a host with getaddrinfo() that can't resolve ipv6! True.
> > That's a bug indeed.
>
> Basically yet, but also an IPv6-only host that cannot resolve to an IPv4
> address (rare case I know).

That case should already be taken care of since we ask for
getaddrinfo(PF_INET) in that case, which then shouldn't return any ipv6 hosts,
only ipv4. And if the resolver cannot return any ipv4 hosts then it should
return failure on such a resolve.

> > Gosh. The reason for that socket(PF_INET6) check there is that some
> > platforms (Linux is one) perform drasticly slower name resolves if
> > attempting to resolve getaddrinfo(PF_UNSPEC) without having an
> > ipv6-enabled stack.
>
> Then it's more important that C-ares should support IPv6. Can't be that
> hard,.. or?

Dominick Meglio is doing good work on the c-ares front, so perhaps we can
persuade him to make it resolve AAAA entries too one day.

It would be cool if the c-ares build would become the default build for
curl...

> BTW. The hostip.c code "socket(PF_INET6,)" will always fail on Win-XP if no
> IPv6 stack present.

Isn't that what we want?

> IMHO it's better to have socket() fail in url.c instead (so we know the
> resolve part is okay).

Yes, moving the test to be made once for several resolves would be smarter
since the situation isn't likely to change very frequently! :-) (Even though
loading the ipv6 as a kernel module in Linux changes what that socket() call
returns.)

> Don't know why all targets couldn't use such heuristics.

I think most systems can. At least the ones that work today.

> And also, there seems to be no way in Win-2k/XP w/o a IPv6 stack to print an
> IPv6 address (allthough getaddrinfo() returns AF_INET6 just fine).

Why do we need to print the address? When without a (working) IPv6 stack we
shouldn't ask for IPv6 addresses anyway, right?

> It would be handy to add a inet_ntop() (and inet_pton()) function for this
> case. I have one adapted from Paul Vixies implementation.

We have Paul Vixies' inet_pton.c file already! ;-)

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