[ntp:questions] getaddrinfo2: "" invalid host address.

Danny Mayer mayer at ntp.isc.org
Tue Oct 16 01:15:12 UTC 2007

Rick Jones wrote:
> Aggie <c.kevin.lam at gmail.com> wrote:
>> Sorry for posting the whole output messages.
>> When I run ntpd with the debug option, I get the followings:
>> //please take a quick look.
>> If you do the search on "calling getaddrinfo(,...)" from
>> the following log, you will see
>> getnetnum: calling getaddrinfo(,...)
>> reval before = 7476272
>> retval = 9
>> getaddrinfo2: "" invalid host address.
>> I'm very sure that is the ip address of my host address.
>> But then why is it saying it's invalid host address??
>> It's weird getaddrinfo() is returning 9. Why??
> Can you also take a tcpdump trace to see if the getaddrinfo() call
> results in DNS traffic?  The getaddrinfo() call, while normally meant
> to map a hostname (what I think you called a host address) to an IP
> address, can be passed an IP adddress - as a string - and it will use
> that.  However, if it decided to pass that particular sort of IP
> address to a DNS server, some DNS servers will not be pleased with an
> RFC1918 "private" IP such as a 192.168 and may return an error
> message.  One would think that a well-written getaddrinfo() would
> notice correctly when something was an IP rather than a name but then
> with my experience with netperf, there are still steps on the learning
> curve for getaddrinfo implementations...
> Now, if that code in NTP is really trying to map from an IP address to
> a host name, then it should be calling getnameinfo() rather than
> getaddrinfo().
> EBADF (errno 9) is indeed a bit strange to be getting - makes me
> wonder if the socket() call made by getaddrinfo() was unsuccessful.  A
> system call trace of the behaviour migth be a good thing to take - you
> would then see the system calls being made and which failed within the
> getaddrinfo() call.  However, looking at the manpage (HP-UX 11.11) for
> getaddrinfo() tells me that the return value isn't an errno but a
> getaddrinfo-specific error code.  In that context a value of "9" might
> not be so weird.   On my system it seems those values (EAI_mumble) are in /usr/include/netdb.h:
> $ find /usr/include -exec grep -l EAI_FAIL {} \;
> /usr/include/netdb.h
> and when I look there it suggests that a value of 9 means:
> #  define EAI_SERVICE      9      /* service not supported for ai_socktype */
> which implies (in my mind) that one of the struct addrinfo fields were
> off a bit as to as_socktype or ai_protocol.
> rick jones


As I'm sure you know from BIND9 this is almost certainly caused by it
trying to look up the A or AAAA record for the IP address ""
which is obviously an IP address and not a name. The question is why?
That's the reason I want to see the config file.


More information about the questions mailing list