[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getaddrinfo() and AI_ADDRCONFIG

From: Christopher Cramer
Subject: getaddrinfo() and AI_ADDRCONFIG
Date: Mon, 8 Apr 2002 22:29:29 -0500
User-agent: Mutt/1.2.5i

There are a lot of programs now using getaddrinfo() for name
resolution, and they often end up searching for unnecessary ipv6
addresses because PF_UNSPEC is taken to mean "look for all addresses"
instead of "look for any address" (which is what rfc2553 seems to say).

This would not be a big problem except for the situation where the ipv4
address for a hostname is available in /etc/hosts, and the name server
is temporarily unavailable. Often something like telnetd will hang for
a long time trying to lookup a name that is already in /etc/hosts. I
don't really understand why more than one address is ever necessary.

I've read that the AI_ADDRCONFIG is supposed to be used, either with
getaddrinfo() or getipnodebyname(), but this doesn't work with my version
of glibc (2.2.5-4 from Debian) since AI_ADDRCONFIG isn't defined in
any header.

I have three questions:

1. Is there anything I can put in /etc/nsswitch.conf or /etc/hosts
to keep getaddrinfo() with PF_UNSPEC from hanging? I can't find anything
in the glibc manual about this, although I have been told to look there.

2. Is glibc going to support AI_ADDRCONFIG in a future version?

3. In my own programs, should I just use PF_INET, and forget about
ipv6 support? I won't be using ipv6 myself in the forseeable future.

Thanks for the help.

Christopher Cramer <address@hidden> <http://www.pyro.net/~crayc/>
Quoi que vous fassiez, écrasez l'infâme, et aimez qui vous aime.
        -- Voltaire

reply via email to

[Prev in Thread] Current Thread [Next in Thread]