From 3848059f194c24bf4a39ffe5ba0d26b9eb477b66 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 2 May 2023 17:39:06 +0200 Subject: [PATCH] Only use ifname for link-local discovery scopes. Fixes #283. --- RNS/Interfaces/AutoInterface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RNS/Interfaces/AutoInterface.py b/RNS/Interfaces/AutoInterface.py index 8d6d12f..aeb45fa 100644 --- a/RNS/Interfaces/AutoInterface.py +++ b/RNS/Interfaces/AutoInterface.py @@ -196,7 +196,11 @@ class AutoInterface(Interface): discovery_socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP, mcast_group) # Bind socket - addr_info = socket.getaddrinfo(mcast_addr+"%"+ifname, self.discovery_port, socket.AF_INET6, socket.SOCK_DGRAM) + if self.discovery_scope == AutoInterface.SCOPE_LINK: + addr_info = socket.getaddrinfo(mcast_addr+"%"+ifname, self.discovery_port, socket.AF_INET6, socket.SOCK_DGRAM) + else: + addr_info = socket.getaddrinfo(mcast_addr, self.discovery_port, socket.AF_INET6, socket.SOCK_DGRAM) + discovery_socket.bind(addr_info[0][4]) # Set up thread for discovery packets