curl-library
Re: ares and ipv6
Date: Mon, 17 Mar 2008 12:44:29 +0100 (CET)
On Sun, 16 Mar 2008, Phil Blundell wrote:
> It seems that recent versions of libc-ares have tolerably good support
> for IPv6 lookups. But a couple of curl changes are needed to make this
> work properly:
>
> - ares doesn't support IP literals, so Curl_addrinfo() needs to detect
> this and handle the conversion itself, just as for IPv4
>
> - Curl_he2ai is currently hardcoded for AF_INET addresses. It needs to
> be able to convert both IPv4 and IPv6.
>
> I've attached a patch that works for me.
Thanks! This is something we've been wanting...
First, you should try building after having done "./configure --enable-debug"
and gcc will point out a few nits in your patch. They're easily fixed though.
Some other concerns about the patch:
o - Using getaddrinfo to check for and convert an IP6-only address to a struct
addrinfo result. Is that really an effective way? We do have a inet_pton()
function in use in the code already?
o - I'm a bit concerned about the returning of the result directly from what
getaddrinfo() returns as that requires a call to freeaddrinfo() while data
that c-ares returns will not. I sense that there's either a memory leak or
a memory mixup somewhere in there. Did you valgrind your tests?
o - The uncondtional use of "struct sockaddr_in6" in the ip4-code will cause
grief on systems that truly have no ipv6 support whatsoever. It needs some
crafty #ifdefs or other magic to make it build on such systems as well.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-03-17