* Julien Puydt <julien.pu...@gmail.com>, 2022-02-04, 12:34:
I got an RC bug on python-anyio, because its testsuite fails when run on an IPv6-only host [1].
I'm pretty sure "IPv6-only" means "the only non-loopback addresses this host has are IPv6", rather than "it doesn't have any IPv4, not even 127.0.0.1."
This project uses AI_ADDRCONFIG: "IPv4 addresses are returned […] if the local system has at least one IPv4 address configured, […] The loopback address is not considered for this case as valid as a configured address."
Somewhat surprisingly, this means that getaddrinfo("127.0.0.1", ...) can fail even when the 127.0.0.1 address exists.
To reproduce this, unshare the network ("unshare -c -r --keep-caps" or "sudo unshare -n") and run:
$ ip link set lo up $ ip link add dum0 type dummy $ ip link set dum0 up $ ip -br addr lo UNKNOWN 127.0.0.1/8 ::1/128 dum0 UNKNOWN fe80::50aa:f3ff:fe1a:e828/64 $ python3 -c 'from socket import *; getaddrinfo("127.0.0.1", port=1, flags=AI_ADDRCONFIG)' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.9/socket.py", line 954, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -9] Address family for hostname not supported -- Jakub Wilk