gethostby* users

Steve Langasek vorlon at
Fri Oct 12 20:55:05 GMT 2007

On Fri, Oct 12, 2007 at 11:10:15AM -0700, Ulrich Drepper wrote:

> Andrew Bartlett wrote:
> > Some parts of the protocol just don't
> > allow for anything but IPv4, but where we can, things are being updated
> > for Samba 3.2.  

> I've pointed out at numerous occasions that getaddrinfo is not for IPv6
> only.  You should always use getaddrinfo, even for IPv4-only situations.
>   See


> The gethostby* interfaces simply don't cut it in today's network anymore.

Generally true.  As a minor caveat, I would mention that getaddrinfo() in
the most recent glibc applies an ill-advised sorting rule (RFC 3484 section
6, rule 9) to IPv4 addresses which breaks the expected round-robin behavior
of gethostby* for no particular benefit (the addresses are sorted by length
of prefix match, which doesn't at all map to how the Internet is put

So at present, migrating to getaddrinfo() is not entirely without tradeoffs.

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon at                         

More information about the samba-technical mailing list