[ntp:questions] Pool returns IPv6 address to IPv4 query

Danny Mayer mayer at ntp.org
Wed Nov 20 17:19:49 UTC 2013

On 11/19/2013 10:48 PM, Brian Utterback wrote:
> On 11/19/2013 3:40 PM, Danny Mayer wrote:
>> You should not be using literal IP addresses of either flavor without
>> also setting the AI_NUMERICHOST flag otherwise it tries to do a DNS
>> lookup. That's poorly written code otherwise.
>> Danny
> Not so. The getaddrinfo function will recognize literal addresses and
> merely convert them. The point is that for something like ssh or any
> other network utility, the user is supposed to give a hostname, but in
> virtually all cases you can give a literal address and the application
> does not have to treat it differently. If you read the ipng mailing
> list, you will see that they were trying to make the whole process of
> writing a network application simpler, with getaddrinfo doing the heavy
> lifting for all of the major cases. At the same time they were trying to
> allow applications to work on either IPv4 or IPv6 systems without
> changing them, or dual stack or any combination. But no matter what they
> did there were edge cases that needed to work differently.
> Brian Utterback

That wasn't true the last time I had to read the source code for
getaddrinfo(). A number of years ago I was debugging a problem with ntpd
on a Unix box, I think it was FreeBSD, and it was doing a DNS Lookup.
The ntpd code checks the string and sees if it is an IP address and
takes the appropriate action before calling getaddrinfo(), at least it
used to.


More information about the questions mailing list