Subject: Re: ares_gethostbyname()

Re: ares_gethostbyname()

From: Gisle Vanem <>
Date: Sun, 23 Jul 2006 13:05:12 +0200

"Daniel Stenberg" <> wrote:

> I'm under the impression that the IPv6 parts of c-ares still aren't very
> widely used and might still suffer from artifacts like this. For example, we
> don't use it for ipv6 in libcurl.

We use it now ... since I added support for the combination USE_ARES and
ENABLE_IPV6. With that libcurl resolves hostnames to IPv6 addresses fine.
Maybe that's why c-ares was changes to act like getaddrinfo() (A-records first,
then AAAA-records).

BTW. With the above combo, I've found a bug. In hostasyn.c / addrinfo_callback():

 * IPv6: Curl_addrinfo_copy() returns the input pointer!
Curl_addrinfo *ai = Curl_addrinfo_copy(addr, conn->async.port);

'addr' comes from c-ares and gets freed when the callback returns. This leads
to a double free and crash if CURLDEBUG is enabled. What to do? Modify c-ares
or modify Curl_addrinfo_copy to do a deep-copy when using c-ares?

Received on 2006-07-23