On Thu, 27 Mar 2008, Matti Aarnio wrote:
There will be lots of legacy codes using legacy APIs for long future.
I do use getaddrinfo() API myself, and permit it do all queries to
get addresses. Thus it will also query for A in addition to AAAA.
It can even be ordered to ignore IPv4 or IPv6 as sysadmin wants.
There's an amusing interop issue with getaddrinfo and DNS lookups in MTAs.
In many implementations getaddrinfo will perform SRV lookups for you (as
an extension to /etc/services or getservbyname), so it probably doesn't do
the right thing (or it can be persuaded not to do the right thing by
people with perverse DNS setups). On Mac OS X, the daemon that handles
getaddrinfo has a special case for port 25 which performs MX lookups for
you (like SRV lookups), so it certainly does't do the right thing! Serious
email software needs to talk to the low-level resolver API in situations
when it cares about the detailed semantics of domain resolution, and it
needs a way of talking to the high-level resolver API when the sysadmin
chooses so that /etc/hosts, /etc/nsswitch.conf, and similar platform-
specific settings can do their thing.
If anything this understates the problems MTAs face. Sure, you can use your own
resolver routines and avoid these semantics issues with getaddrinfo, but now
you're doing purely DNS-based address lookup. It may not be standardized, but
it is surprisingly common to use other name services or host files for this
within an administative domain. And while it may be possible to duplicate the
logic to do these other sorts of lookups, you're now talking about
substantially more code and complexity, not to mention platform and
IETF mailing list