On Monday 28 March 2011 13:12, Sergey Naumov wrote:
> Hello.
> 
> Some programs (ex. arp) are trying to resolve addresses (even if they
> are specified in xxx.xxx.xxx.xxx form).

This should not happen, there is code in libbb/xconnect.c to prevent it:


        /* Next two if blocks allow to skip getaddrinfo()
         * in case host name is a numeric IP(v6) address.
         * getaddrinfo() initializes DNS resolution machinery,
         * scans network config and such - tens of syscalls.
         */
        /* If we were not asked specifically for IPv6,
         * check whether this is a numeric IPv4 */
        IF_FEATURE_IPV6(if(af != AF_INET6)) {
                struct in_addr in4;
                if (inet_aton(host, &in4) != 0) {
                        r = xzalloc(LSA_LEN_SIZE + sizeof(struct sockaddr_in));
                        r->len = sizeof(struct sockaddr_in);
                        r->u.sa.sa_family = AF_INET;
                        r->u.sin.sin_addr = in4;
                        goto set_port;
                }
        }
#if ENABLE_FEATURE_IPV6
        /* If we were not asked specifically for IPv4,
         * check whether this is a numeric IPv6 */
        if (af != AF_INET) {
                struct in6_addr in6;
                if (inet_pton(AF_INET6, host, &in6) > 0) {
                        r = xzalloc(LSA_LEN_SIZE + sizeof(struct sockaddr_in6));
                        r->len = sizeof(struct sockaddr_in6);
                        r->u.sa.sa_family = AF_INET6;
                        r->u.sin6.sin6_addr = in6;
                        goto set_port;
                }
        }
#endif



> In the case of arp it is 
> possible to use "-n" option to prevent it, but is there a way to
> disable address resolution globally? Removal of /etc/hosts works for
> me, but is it possible to allow resolver look only into /etc/hosts and
> make it return error if there is not an appropriate entry? Now it
> tries to resolve even IP addresses and exits by timeout 3 times per IP
> address.

You mixed a "how to disable resolver" question with a bug report
"even numeric IPs are resolved".

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

Reply via email to