From 379e56b2ce3131edbbaf6bd5beff7b91a4e0452f Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 7 Jun 2022 12:40:50 +0200 Subject: [PATCH] Socket option check for OpenWRT compatibility --- RNS/Interfaces/AutoInterface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RNS/Interfaces/AutoInterface.py b/RNS/Interfaces/AutoInterface.py index 0f4c02d..fc7bcee 100644 --- a/RNS/Interfaces/AutoInterface.py +++ b/RNS/Interfaces/AutoInterface.py @@ -168,7 +168,8 @@ class AutoInterface(Interface): # Set up multicast socket discovery_socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) discovery_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - discovery_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) + if hasattr(socket, "SO_REUSEPORT"): + discovery_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) discovery_socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, if_struct) # Join multicast group