From 9a97195b8c9097a247e01b16a2c021fc116f7ca9 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Fri, 20 Sep 2024 17:50:34 +0100 Subject: [PATCH] Fix interface values not being set on RNodeSubInterface instances --- RNS/Interfaces/RNodeMultiInterface.py | 10 ++++++++-- RNS/Reticulum.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/RNS/Interfaces/RNodeMultiInterface.py b/RNS/Interfaces/RNodeMultiInterface.py index 61bee08..fb18d26 100644 --- a/RNS/Interfaces/RNodeMultiInterface.py +++ b/RNS/Interfaces/RNodeMultiInterface.py @@ -249,6 +249,7 @@ class RNodeMultiInterface(Interface): if (not self.validcfg): raise ValueError("The configuration for "+str(self)+" contains errors, interface is offline") + def start(self): try: self.open_port() @@ -323,8 +324,8 @@ class RNodeMultiInterface(Interface): lt_alock=subint[9] ) - interface.OUT = self.OUT - interface.IN = self.IN + interface.OUT = subint[10] + interface.IN = True interface.announce_rate_target = self.announce_rate_target interface.mode = self.mode @@ -1006,6 +1007,11 @@ class RNodeSubInterface(Interface): 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 diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index 30e4acc..9a9d53a 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -971,7 +971,7 @@ class Reticulum: 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: @@ -1000,6 +1000,11 @@ class Reticulum: 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 @@ -1025,10 +1030,8 @@ class Reticulum: 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 @@ -1079,6 +1082,9 @@ class Reticulum: RNS.Transport.interfaces.append(interface) + if isinstance(interface, RNS.Interfaces.RNodeMultiInterface.RNodeMultiInterface): + interface.start() + else: RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)