Subject: ares_gethostbyname fails to resolve localhost with AF_INET6

ares_gethostbyname fails to resolve localhost with AF_INET6

From: Sebastian Ramacher <s.ramacher_at_gmx.at>
Date: Thu, 02 Jun 2011 00:34:49 +0200

Hi,

Since my first mail didn't seem to reach the list - it can't be found in the
list archive - I'm resending it. I'm sorry if you got it twice.

As I understand the source ares_gethostbyname together with AF_INET6 falls back
to AF_INET if no IPv6 address can be found (at least if a DNS server is
queried). But this does not seem to be true for hosts in /etc/hosts. For example
localhost fails to resolve with ares_gethostname together with AF_INET6.

As some programs depend on this fallback behavior (znc for example) it would be
nice to have the same for hosts defined in /etc/hosts. A possible fix would be
to do the following in next_lookup: if file_lookup fails with AF_INET6 retry
with AF_INET.

Kind regards,

-- 
Sebastian Ramacher

Received on 2011-06-02