[PATCH v5 1/2] resolv: implement ipv4+ipv6 flags in resolv.conf (bug 30544)
Florian Weimer
fweimer@redhat.com
Wed Oct 15 20:05:19 GMT 2025
* Petr Menšík:
> Add separate flags to mark support of address family. Its intention is
> to react dynamically to changing network conditions. If the host has
> IPv4 connectivity only, it would set ipv4 option. If it has also IPv6
> connectivity, it would set ipv6 option. If it connects IPv6-only
> network, then it set ipv6 only.
>
> For backward compatibility it will keep old behaviour when both ipv4 and
> ipv6 flags are missing. In this case it behaves the same way as if both
> were present.
>
> This is quite useful when default AF_UNSPEC is used in hints, but the
> host is on network with just single AF used.
>
> Unlike no-aaaa option it would change just AF_UNSPEC behaviour, ie.
> getent ahosts example.com. getent ahostsv4 and getent ahostsv6 would
> remain unmodified.
These should be /etc/gai.conf options. This means that we get extra
queries for IPv6 mode (which has to use gethostnameby4 if AAAA lookups
are requested even if A lookups are disabled). We can disable those for
the internal dns module through an internal interface, but it won't help
external NSS modules. For those, a new interface would be needed.
I consider _res.options an obsolescent interface, but this change would
encourage NSS modules to examine it, potentially having to call res_init
first. Parsing /etc/gai.conf would be getaddrinfo's responsibility.
I understand that replacing gethostbyname4 is a major undertaking
(because it would make sense to get rid of the ERANGE protocol at the
same time).
Thanks,
Florian
More information about the Libc-alpha
mailing list