On 11/19/2013 12:33 PM, Rick Jones wrote: > Danny Mayer <[email protected]> wrote: >> That must have been a short discussion. getaddrinfo() has nothing to >> do with the IP stack. getaddrinfo()'s job is to get information from >> the nameservers you specify in resolv.conf or wherever else the OS >> has that information. Its job is NOT to make decisions about what it >> should ask for. That's the programmer's job when setting up the API >> call as to what addresses to ask for. > > I suspect it all boils down to the behaviour when one sets > AI_ADDRCONFIG in the getaddrinfo() call. When that is set, ostensibly > getaddrinfo() is supposed to filter-out any reponses that are of a > type that cannot be used by the application. The decision made was if > there were no non-loopback-interface IPv6 addresses configured, AAAA > records would not be returned from the getaddrinfo() call. Similarly > for A recorecords if there were no IPv4 addresses configured on the > system.
That's not the what you need to do if you only want IPv4. You need to set ai_family to AF_INET in the hints structure before making the call. IF you specify -4 on the ntpd command line, that's what we do when fetching IP addresses from the name server. There's no magic here, it just works. Danny _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
