mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Ignore AWDL interfaces on Darwin
This commit is contained in:
parent
29aa4f9315
commit
fca03bbdce
@ -21,6 +21,8 @@ class AutoInterface(Interface):
|
|||||||
|
|
||||||
PEERING_TIMEOUT = 9.0
|
PEERING_TIMEOUT = 9.0
|
||||||
|
|
||||||
|
DARWIN_IGNORE_IFS = ["awdl0", "llw0"]
|
||||||
|
|
||||||
def __init__(self, owner, name, group_id=None, discovery_scope=None, discovery_port=None, data_port=None, allowed_interfaces=None, ignored_interfaces=None):
|
def __init__(self, owner, name, group_id=None, discovery_scope=None, discovery_port=None, data_port=None, allowed_interfaces=None, ignored_interfaces=None):
|
||||||
import importlib
|
import importlib
|
||||||
if importlib.util.find_spec('netifaces') != None:
|
if importlib.util.find_spec('netifaces') != None:
|
||||||
@ -99,7 +101,7 @@ class AutoInterface(Interface):
|
|||||||
|
|
||||||
suitable_interfaces = 0
|
suitable_interfaces = 0
|
||||||
for ifname in self.netifaces.interfaces():
|
for ifname in self.netifaces.interfaces():
|
||||||
if ifname in self.ignored_interfaces:
|
if ifname in self.ignored_interfaces or (RNS.vendor.platformutils.get_platform() == "darwin" and ifname in AutoInterface.DARWIN_IGNORE_IFS):
|
||||||
RNS.log(str(self)+" ignoring disallowed interface "+str(ifname), RNS.LOG_EXTREME)
|
RNS.log(str(self)+" ignoring disallowed interface "+str(ifname), RNS.LOG_EXTREME)
|
||||||
else:
|
else:
|
||||||
if len(self.allowed_interfaces) > 0 and not ifname in self.allowed_interfaces:
|
if len(self.allowed_interfaces) > 0 and not ifname in self.allowed_interfaces:
|
||||||
@ -129,7 +131,6 @@ class AutoInterface(Interface):
|
|||||||
discovery_socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
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_REUSEADDR, 1)
|
||||||
discovery_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
discovery_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||||
|
|
||||||
discovery_socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, if_struct)
|
discovery_socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, if_struct)
|
||||||
|
|
||||||
# Join multicast group
|
# Join multicast group
|
||||||
|
Loading…
Reference in New Issue
Block a user