[PATCH] new applet gethostbyname

Eial Czerwacki eial at scalemp.com
Wed Jul 4 08:25:21 UTC 2012


On 07/04/2012 10:18 AM, Eial Czerwacki wrote:

> On 07/04/2012 10:02 AM, Paul Smith wrote:
> 
>>
>> I don't understand what you mean.  There's no need to add parsing
>> for /etc/hosts to anything.  The library already has that parsing code;
>> it's all embedded under the gethostbyname() function.  Since you're
>> already invoking gethostbyname() you're already paying for the overhead
>> of the code that parses the /etc/hosts file.
>>
>> The right thing to do in what sense?  The right thing to do for your
>> environment?  Obviously only you can decide whether you'd rather have
>> the host(1) or getent(1) applets.  Both are useful, in different
>> contexts.
>>
>> The getent(1) utility is useful for all sorts of scripting needs.  It's
>> far and away the most likely to be useful in a normal Busybox
>> environment.  The lucky thing is it's also simpler to write and will
>> result in much less code added to Busybox.
>>
>> The host(1) utility is really mainly useful when you're debugging DNS
>> problems and/or servers.  It's not so useful for general scripting
>> because the IP address you get back from it might not be the same IP
>> address as some program you invoke (ping or ssh or telnet or whatever
>> for example) would use for that same hostname, which can be confusing.
>>
>> Also as far as I'm aware there's no standard C runtime function which
>> you can use to implement host(1), so you'll have to recreate a
>> significant chunk of the DNS server access code, which WOULD be a lot of
>> work and a lot of new, somewhat complex code added to Busybox.  My
>> suspicion is that the Busybox maintainers would be leery of accepting
>> this and might suggest you just go get the real host(1) application from
>> BIND and use that instead.
>>
>>

after understanding what Paul and Harald meant, I'll rewrite the patch
and post it later on.

Thanks of the clarification guys.

Eial.



More information about the busybox mailing list