diff --git a/RNS/Interfaces/RNodeMultiInterface.py b/RNS/Interfaces/RNodeMultiInterface.py index 13e24ca8..6edee9a3 100644 --- a/RNS/Interfaces/RNodeMultiInterface.py +++ b/RNS/Interfaces/RNodeMultiInterface.py @@ -249,6 +249,7 @@ def __init__(self, owner, name, port, subint_config, id_interval = None, id_call if (not self.validcfg): raise ValueError("The configuration for "+str(self)+" contains errors, interface is offline") + def start(self): try: self.open_port() @@ -327,11 +328,8 @@ def configure_device(self): self.online = False raise IOError(str(interface) + " failed to initialise.") - interface.OUT = self.OUT - interface.IN = self.IN - - interface.announce_rate_target = self.announce_rate_target - interface.mode = self.mode + interface.OUT = subint[10] + interface.IN = True interface.HW_MTU = self.HW_MTU interface.detected = True RNS.Transport.interfaces.append(interface) @@ -1024,9 +1022,15 @@ def __init__(self, owner, name, parent_interface, index, interface_type, frequen self.parent_interface = parent_interface self.announce_rate_target = None + self.mode = None + self.announce_cap = None + self.bitrate = None + self.ifac_size = None + # add this interface to the subinterfaces array self.parent_interface.subinterfaces[index] = self + self.validcfg = True if (self.interface_type == "SX126X" or self.interface_type == "SX127X"): if (self.frequency < RNodeSubInterface.LOW_FREQ_MIN or self.frequency > RNodeSubInterface.LOW_FREQ_MAX): diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index b16aabad..69a717b2 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -48,6 +48,7 @@ import os import RNS + class Reticulum: """ This class is used to initialise access to Reticulum within a @@ -972,7 +973,7 @@ def __apply_config(self): enabled_count += 1 # Create an array with a row for each subinterface - subint_config = [[0 for x in range(10)] for y in range(enabled_count)] + subint_config = [[0 for x in range(11)] for y in range(enabled_count)] subint_index = 0 for subinterface in c: @@ -1001,6 +1002,11 @@ def __apply_config(self): subint_config[subint_index][8] = st_alock lt_alock = float(subinterface_config["airtime_limit_long"]) if "airtime_limit_long" in subinterface_config else None subint_config[subint_index][9] = lt_alock + + if "outgoing" in subinterface_config and subinterface_config.as_bool("outgoing") == False: + subint_config[subint_index][10] = False + else: + subint_config[subint_index][10] = True subint_index += 1 # if no subinterfaces are defined @@ -1017,6 +1023,7 @@ def __apply_config(self): if port == None: raise ValueError("No port specified for "+name) + interface = RNodeMultiInterface.RNodeMultiInterface( RNS.Transport, name, @@ -1026,10 +1033,8 @@ def __apply_config(self): id_callsign = id_callsign ) - if "outgoing" in c and c.as_bool("outgoing") == False: - interface.OUT = False - else: - interface.OUT = True + interface.IN = False + interface.OUT = False interface.mode = interface_mode @@ -1077,6 +1082,10 @@ def __apply_config(self): interface.ifac_identity = RNS.Identity.from_bytes(interface.ifac_key) interface.ifac_signature = interface.ifac_identity.sign(RNS.Identity.full_hash(interface.ifac_key)) + if isinstance(interface, RNS.Interfaces.RNodeMultiInterface.RNodeMultiInterface): + interface.start() + + RNS.Transport.interfaces.append(interface) else: