Subject: Re: Multiple IP addresses for a single host in "/etc/hosts"
To: Matthias Scheler <tron@lyssa.owl.de>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-net
Date: 05/30/1999 16:26:31
tron@lyssa.owl.de (Matthias Scheler) writes:
> if a host has multiple entries in "/etc/hosts" right now gethostbyname()
> returns only the first IP address. I think about enhancing _gethtbyname2()
> to build a "struct hostent *" with all IP addresses. To maintain backward
> compatibility the IP addresses will be in exact the same order as in
> "/etc/hosts". Opinions?

Is there any non-broken code that requires gethostbyname() to return
exactly one address?

It seems to me that having multiple lines listing the host in
/etc/host should behave no differently than DNS lookups where multiple
A records are returned...

Of course, with /etc/hosts there's an efficiency issue (i.e. it'd be
nice to just fine one match and return, rather than having to scan the
whole file), but that's perhaps best addressed via a (new)
nsswitch.conf option.



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.