This is similar to (but does not fix) #13155 which I believe is the same issue but in libevent.
The issue is on a host that has IPV6 enabled but only a loopback IP address -proxy=[::1]
will fail as [::1]
is not considered valid by getaddrinfo
with AI_ADDRCONFIG
flag. I think the loopback interface should be considered valid and we have a functional test that will try to test this: feature_proxy.py
.
To replicate the issue, run feature_proxy.py
inside a docker container that has IPV6 loopback ::1 address without specifically giving that container an external IPV6 address. This should be the default with recent versions of docker. IPV6 on loopback interface was enabled in docker engine 26 and later (https://docs.docker.com/engine/release-notes/26.0/#bug-fixes-and-enhancements-2).
AI_ADDRCONFIG
was introduced to prevent slow DNS lookups on systems that were IPV4 only.
References:
Man section on AI_ADDRCONFIG
:
0If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by res only if the local system has at least one IPv4 address configured, and IPv6 addresses
1 are returned only if the local system has at least one IPv6 address configured. The loopback address is not considered for this case as valid as a configured address. This flag is useful on, for ex‐
2 ample, IPv4-only systems, to ensure that getaddrinfo() does not return IPv6 socket addresses that would always fail in connect(2) or bind(2).
AI_ADDRCONFIG considered harmful Wiki entry by Fedora
Mozilla discussing slow DNS without AI_ADDRCONFIG and also localhost issues with it