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

On Sat, Dec 05, 2009 at 12:43:54PM +0100, Ingolf Steinbach wrote:

> 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?

You don't know how the adresses are used and, at the time of the
getaddrinfo() call, you don't know wether you can use these addresses
for a connection. Even more, socket(), bind() and connect() will happily
tell you when they do not support the requested family or when
they cannot connect to the requested address and you can and
should continue by trying the next address. This is how
you should handle the answer from getaddrinfo(), independent
of IPv4 or IPv6.

> 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)

See my answer to kre, that dependency isn't necessarily valid and

> c) if both v4 and v6 are supported, make the decision on selection /
> ordering configurable.

if you already want a separate configuration as a workaround (like I
suggested) then this will allow you to do the same.

                                Michael van Elst
                                "A potential Snark may lurk in every tree."

Home | Main Index | Thread Index | Old Index