cURL / Mailing Lists / curl-library / Single Mail

curl-library

getaddrinfo() of multi-IP returns the same one first

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 20 Oct 2005 00:27:22 +0200 (CEST)

Hi

I'd like to ask a question about getaddrinfo() and name resolving, to see if
there's someone around here that can fill in some blanks for me!

I'm sitting here staring at bug report #1326306:

         http://curl.haxx.se/bug/view.cgi?id=1326306

For the purpose of repeating this, I created this host name: bad10.haxx.se.

It resolves to 5 IP addresses, one being 127.0.0.1 and the rest being
10.10.10.1-4. The plan was that the 10.* ones should fail and the 127.* one
would work (if you run a local server).

But for some reason, when I run the app (or plain curl) it _always_ tries the
127.0.0.1 address first. It seems getaddrinfo() simply returns the addresses
like that. The 10.* addresses seem to appear in different order different
times.

Why is this? If I do 'nslookup bad10.haxx.se' it seems to output the addresses
in different order...

Am I hallucinating?

Anyone with a clue to offer?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-10-20