Hello Harald,

On 07/04/2012 08:34 AM, [email protected] wrote:

> Hi Eial !
> 
>> does getent needs a valid host file in the system?
> 
> First of all, an empty file is a valid host file. As a missing file is
> usually assumed to equal an empty file, the host file doesn't need to
> be there either.
> 
>> after viewing both host and getent I'm sure that host is exactly what
>> I've implemented. I don't think it is a good idea to base the
>> implementation on getent.
> 
> host is a pure and direct DNS query which does NOT use gethostbyname
> (or similar mechanism) to get any local stored name. On the other side
> 'getent hosts'  uses the libc functionality (also used by gethostbyname)
> to query the IP address by it's name. glibc uses nsswitch to configure
> how this query is done and this is usually 'host, bind': which
> means it first tries to lookup the name in /etc/host and to query the
> DNS server afterwards if not found locally.
> 
> If you use gethostbyname to query the IP address you have implemented
> the functionality of 'getent hosts' with a single key (= name)
> specification not the pure DNS based host command from bind package
> (which does only DNS query and ignores locally provided addresses).
> 
> I hope that clarifies this.


that clears the issue.

so gethostbyname (or getaddrinfo as suggested by Baruch) doesn't checks
the local /etc/host first?

Eial.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to