Automatically select IPv6 address for IPv6-only interfaces

pull/625/head
Mark Qvist 2024-11-20 19:16:15 +01:00
rodzic 1282061701
commit 212af2f43b
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -422,7 +422,7 @@ class TCPServerInterface(Interface):
if len(ifaddr) < 1:
raise SystemError(f"No addresses available on specified kernel interface \"{name}\" for TCPServerInterface to bind to")
if prefer_ipv6 and netinfo.AF_INET6 in ifaddr:
if (prefer_ipv6 or not netinfo.AF_INET in ifaddr) and netinfo.AF_INET6 in ifaddr:
bind_ip = ifaddr[netinfo.AF_INET6][0]["addr"]
if bind_ip.lower().startswith("fe80::"):
# We'll need to add the interface as scope for link-local addresses