From 212af2f43bbb01cf24b5615412c54a251c76a01d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 20 Nov 2024 19:16:15 +0100 Subject: [PATCH] Automatically select IPv6 address for IPv6-only interfaces --- RNS/Interfaces/TCPInterface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py index 6a371bf..6015aba 100644 --- a/RNS/Interfaces/TCPInterface.py +++ b/RNS/Interfaces/TCPInterface.py @@ -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