NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/42405: libc: getaddrinfo() should perform T_A lookups before T_AAAA lookups, was: Resolver problems

2009/12/5 Michael van Elst <>:
> With the same argument you could say that a 'nslookup' or 'dig'
> should fail to query AAAA records when your kernel cannot handle
> IPv6.

I don't think that the argument is equivalent: nslookup and friends
are tools to explicitly look up various types of information offered
by DNS servers -- not just addresses. You (typically) explicitly tell
the tool to lookup A, NS, TXT, whatever and possibly also AAAA

> getaddrinfo() is pretty agnostic. You tell it you want IPv4, you get
> IPv4. You tell it you want IPv6, you get IPv6. You don't tell it anything,
> you will get either.

According to POSIX, getaddrinfo() "shall return a set of socket
addresses and associated information to be used in creating a socket
with which to address the specified service." What is the use of
delivering socket addresses which will certainly fail later when used
as intended by this specification?

My suggestion would be:
a) keep the application protocol agnostic
b) avoid run-time errors by having getaddrinfo() deliver only v4
addresses on systems which do not support v6 (unless, of course, the
user explicitly requests v6 addresses)
c) if both v4 and v6 are supported, make the decision on selection /
ordering configurable.


Home | Main Index | Thread Index | Old Index