THRIFT-5186: Don't pass AI_ADDRCONFIG to getaddrinfo()
Client: cpp,pas,py
Patch: Max Ulidtko
This closes #2124
If a host doesn't have assigned IPv4 or IPv6 addresses, thrift communication
over localhost-only is impossible due to thrift library bug. It happens
when making getaddrinfo syscall with AI_ADDRCONFIG flag.
From man getaddrinfo(3):
If 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 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.
Upstream bug with AI_ADDRCONFIG ai_flags was fixed for cpp library and win32
platform only. See https://issues.apache.org/jira/browse/THRIFT-2539
Patch based on Thrift 0.13.0, commit cecee50308fc7e6f77f55b3fd906c1c6c471fa2f.
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py
index df25d42..9886fa2 100644
--- a/lib/py/src/transport/TSocket.py
+++ b/lib/py/src/transport/TSocket.py
@@ -39,7 +39,7 @@
self._socket_family,
socket.SOCK_STREAM,
0,
- socket.AI_PASSIVE | socket.AI_ADDRCONFIG)
+ socket.AI_PASSIVE)
def close(self):
if self.handle: