[PATCH] new applet gethostbyname

Eial Czerwacki eial at scalemp.com
Wed Jul 4 06:14:53 UTC 2012


On 07/04/2012 09:00 AM, Paul Smith wrote:

> On Wed, 2012-07-04 at 08:07 +0300, Eial Czerwacki wrote:
> 
> I didn't see your implementation in detail, but if it uses
> gethostbyname() or gethostent() etc. functions in GLIBC, then it IS NOT
> the standard host(1) utility.
> 
> The host(1) utility communicates via the network to the current DNS
> server in /etc/resolv.conf (or the server specified on the host(1)
> command line, if given) and does hostname lookups directly from the DNS
> server.
>

> Consider this: if you do have a hostname in your /etc/hosts file but it
> doesn't exist in the DNS server, then host(1) will _not_ resolve the
> hostname.  getent(1) will.  Similarly, if you have a hostname
> in /etc/hosts which maps to a different IP address than that same
> hostname does on the DNS server, then host(1) will show the DNS server's
> IP address, NOT the one in /etc/hosts, regardless of the contents of
> nsswitch.conf etc.
> 
> If you want to have a command-line interface to the get*ent() functions
> like getpwent(), getgrent(), gethostent(), gethostbyname(), etc., then
> the getent(1) utility is the (only, that I'm aware of) right answer.
> 
> 


that is right but assuming /etc/hosts parsing is added, how can we be
sure that there isn't any changes in file format?

also, adding such parser most probably will increase the size of the
bin, on the other hand, it is possible to add a config switch that
enables /etc/hosts parsing support if it is needed.

for my example, /etc/hosts parsing is not needed and I do need every bit
of space.

Eial.


More information about the busybox mailing list