Red Hat Bugzilla – Bug 59999
Slow DNS resolution with curl when ipv6 is enabled and getaddrinfo is used
Last modified: 2008-05-01 11:38:01 EDT
The "curl" configure script automatically detects that there is ipv6 support and
therefore tries to use getaddrinfo() with ai_family set to PF_UNSPEC in order to
do name resolution.
The problem is, this causes extremely slow name resolution (> 10 secs) for some
(but not all) names. The problem is demostrated with the attached test program
(derived from the curl sources when ipv6 is enabled).
You can repro the problem with the test program (make getaddrinfo):
$ ./getaddrinfo www.yahoo.com www.bloomberg.com
www.yahoo.com: rc = 0, time = 1 secs
www.bloomberg.com: rc = 0, time = 28 secs
The time for resolving www.bloomberg.com will be approximately 10 * (number of
nameservers in /etc/resolv.conf) seconds. In my case, I have 3 nameservers, so
~30 seconds of delay.
Or, you can repro the problem using curl itself to fetch a page from
I've had my friends check this with the same results (even on FreeBSD).
I think the bottom line is that Redhat needs to ship "curl" binaries that have
with --disable-ipv6. I dunno who has the high ground here, but it is
unacceptable to have
these kinds of delays.
Created attachment 45903 [details]
C program which demostrates the problem with using getaddrinfo() in curl
Created attachment 46561 [details]
Fix from CVS
Is this still a problem with curl 7.9.3?
Yes, its broken in curl 7.9.3 if compiled with ipv6 support. Basically, its
if PF_UNSPEC is passed to getaddrinfo(). The curl author has decided to
blow off ipv6 support and change the call to PF_INET, in some future version
of curl that is not yet released.
curl 7.9.5 has the fix and has been built (curl-7.9.5-1)