[uClibc] Problem with uclibc and IPv6 local host lookup

Jaspreet Singh jaspreet_sachdev at yahoo.com
Sat Oct 30 01:31:28 UTC 2004


Hi,

I have various applications (ping6, syslogd, telnet)
fail when using ipv6 and hostname. I do not have a
nameserver setup (no /etc/resolv.conf). All the
hostname entries are listed in the /etc/hosts file. 
These applications return an error/or invalid ip
address in the getaddrinfo() method.

I have been looking at the code for getaddrinfo() in
the latest cvs head. I noticed that in the
gethostbyname2_r () function it calls
__get_hosts_byname_r(..,type,..) with possibily the
wrong type. Shouldn't the type be set to AF_INET6? 
With the type set to AF_INET, the __read_etc_hosts_r()
results in an error. The __read_etc_hosts_r() function
tries to call inet_ntop() using the wrong address
family. 

It seems like that this problem will cause local host
name lookup for IPV6 to fail. Can someone please
verify?

Here is the possible problematic code:

libc/inet/resolv.c

int gethostbyname2_r ()
<snip>

    if (family == AF_INET)
        return gethostbyname_r(name, result_buf, buf,
buflen, result, h_errnop);
	
    if (family != AF_INET6)
        return EINVAL;

    __open_nameservers();
    *result=NULL;
    if (!name)
        return EINVAL;

    /* do /etc/hosts first */
    {
        int old_errno = errno;	/* Save the old errno
and reset errno */
        __set_errno(0);			/* to check for missing
/etc/hosts. */

>>>>>   if ((i=__get_hosts_byname_r(name, AF_INET,
result_buf,buf, buflen, result, h_errnop))==0)



Thanks,
Jaspreet

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the uClibc mailing list