getent ahostsv4 seems to interact with network interface addressing
Florian Weimer
fw@deneb.enyo.de
Sun Nov 5 20:10:50 GMT 2023
* Glenn Golden:
> System:
> Arch linux, glibc 2.38-7, kernel 6.1.59-1, commodity i686 laptop.
>
> Description of issue:
> Not sure if this is a bug or just a misunderstanding on my part as to how
> getent ought to be behaving when attempting lookups using the ahostsv4
> database, expecting it to query and return results from /etc/hosts.
>
> The behavior of "getent ahostsv4 HOSTNAME" seems to strangely depend on
> whether there are any network interfaces presently having an assigned v4
> address, as demonstrated in detail in "Steps to reproduce" below.
By default, getent uses AI_ADDRCONFIG under the covers, and what you
see is the expected behavior of that getaddrinfo option. Recent glibc
versions have a getent option that switches of AI_ADDRCONFIG:
-A, --no-addrconfig do not filter out unsupported IPv4/IPv6 addresses
(with ahosts*)
More information about the Libc-help
mailing list