Skip to content

Commit 64b0c61

Browse files
committed
Skip IPv6 addresses with non-zero scope IDs
1 parent 86882c1 commit 64b0c61

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

neo4j/addressing.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,15 @@ def parse_routing_context(cls, uri):
104104

105105
def resolve(socket_address):
106106
try:
107-
return [address for _, _, _, _, address in
108-
getaddrinfo(socket_address[0], socket_address[1], 0, SOCK_STREAM, IPPROTO_TCP)]
107+
info = getaddrinfo(socket_address[0], socket_address[1], 0, SOCK_STREAM, IPPROTO_TCP)
109108
except gaierror:
110109
raise AddressError("Cannot resolve address {!r}".format(socket_address[0]))
110+
else:
111+
addresses = []
112+
for _, _, _, _, address in info:
113+
if len(address) == 4 and address[3] != 0:
114+
# skip any IPv6 addresses with a non-zero scope id
115+
# as these appear to cause problems on some platforms
116+
continue
117+
addresses.append(address)
118+
return addresses

0 commit comments

Comments
 (0)