cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Workaround for missing ares_getaddrinfo() with IPv4 and IPv6

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 8 Dec 2010 10:49:29 +0100 (CET)

On Mon, 6 Dec 2010, Tommie Gannert wrote:

> this is a patch to let hostares.c request both IPv4 and IPv6 addresses when
> IPv6 is enabled.

Can I ask you to instead make a local function in there called
_ares_getaddrinfo() or something that would have an API that might match what
an _actual_ ares_getaddrinfo() would use?

That would make a much cleaner step towards having c-ares itself provide the
function and once it does it'll be easier to adapt our code to that.

> Currently, c-ares returns IPv4 address when there are no IPv6 addresses, and
> in those cases the Curl DNS cache will contain duplicate addresses.

It returns IPv4 even when you specify family PF_INET6? Isn't that a bug?

> There are no ordering guarantees on which address family comes first in the
> DNS cache. Is that needed?

The DNS cache stores the adresses as Curl_addrinfo structs which should have
the addresses in the same order as the name resolver returned them and that's
how it is supposed to work.

The name resolver is in fact supposed to return the names in preferred order,
but that's a job for c-ares really.

(I haven't yet actually reviewed, applied or tried your patch for real.)

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-08