cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl issue with IPv6 and c-ares

From: Daniel Johnson <daniel.johnson31_at_gmail.com>
Date: Sat, 11 Oct 2008 20:22:55 -0400

On Oct 11, 2008, at 1:12 PM, Phil Blundell wrote:

> On Thu, 2008-10-09 at 12:03 -0400, Daniel Johnson wrote:
>> Maybe it would be safer to default to PF_INET instead? That's what I
>> did locally, by deleting the "default:" line. That way one can still
>> explicitly ask for IPv6, but IPv4 will be used normally.
>> Ultimately, c-
>> ares should probably be enhanced to better match the behavior of
>> getaddrinfo, but I'm already a bit over my head here. :)
>
> You're right that the current behaviour does not look ideal, but
> changing the default from PF_INET6 to PF_INET would just swap one
> problem for another. This change would make it impossible for
> libcurl-using applications to connect to v6-only hosts, since a
> PF_INET
> lookup will just return ARES_NODATA for hosts with only AAAA records.

This is true, however I'm sure that such sites are extremely rare and
would be unreachable in any case from an IPv4-only connection. There
are vastly more people with IPv4-only connections than there are IPv6-
only sites, so the current situation is much more harmful than
changing the default.

>
>
> Making c-ares support AF_UNSPEC would certainly be the ideal thing.
> Unfortunately this looks like it would be quite a lot of work: the
> internal arrangement of the ares code is not particularly amenable to
> returning a mixture of AF_INET and AF_INET6 results for a single
> query.
>> From a pragmatic point of view it might be easier to teach libcurl to
> make two separate ares queries in this case. Would you like to try
> making a patch for that?

I had thought about this and agree that it would solve the problem,
but wasn't sure if it was the best solution. I'll look at the code and
see if I can come up with something.

Daniel
Received on 2008-10-12