Fixed IFAC identity not being available at early tunnel synthesis

This commit is contained in:
Mark Qvist 2026-11-17 01:16:16 +01:00
parent 338df09607
commit 2b1a984c91
No known key found for this signature in database
4 changed files with 30 additions and 24 deletions

View file

@ -922,18 +922,16 @@ class BackboneClientInterface(Interface):
self.target_port = target_port
self.initiator = True
if connect_timeout != None:
self.connect_timeout = connect_timeout
else:
self.connect_timeout = BackboneClientInterface.INITIAL_CONNECT_TIMEOUT
if BackboneClientInterface.SYNCHRONOUS_START:
self.initial_connect()
else:
thread = threading.Thread(target=self.initial_connect)
thread.daemon = True
thread.start()
if connect_timeout != None: self.connect_timeout = connect_timeout
else: self.connect_timeout = BackboneClientInterface.INITIAL_CONNECT_TIMEOUT
def final_init(self):
if BackboneClientInterface.SYNCHRONOUS_START: self.initial_connect()
else:
thread = threading.Thread(target=self.initial_connect)
thread.daemon = True
thread.start()
def initial_connect(self):
if not self.connect(initial=True):
thread = threading.Thread(target=self.reconnect)
@ -969,7 +967,9 @@ class BackboneClientInterface(Interface):
def early_synthesis(self, packet):
if not self.detached:
if not packet.packed: packet.pack()
frame = HDLC.frame(packet.raw)
if self.ifac_identity: raw = RNS.Transport.handle_outgoing_ifac(self, packet.raw);
else: raw = packet.raw
frame = HDLC.frame(raw)
if not self.transmit_buffer.append(frame, self.tx_hwm):
raise IOError("Transmit buffer overflow at early tunnel synthesis")

View file

@ -481,9 +481,11 @@ class I2PInterfacePeer(Interface):
def early_synthesis(self, packet):
if not self.detached:
if not packet.packed: packet.pack()
if self.ifac_identity: raw = RNS.Transport.handle_outgoing_ifac(self, packet.raw);
else: raw = packet.raw
if self.kiss_framing: frame = bytes([KISS.FEND])+bytes([KISS.CMD_DATA])+KISS.escape(packet.raw)+bytes([KISS.FEND])
else: frame = bytes([HDLC.FLAG])+HDLC.escape(packet.raw)+bytes([HDLC.FLAG])
if self.kiss_framing: frame = bytes([KISS.FEND])+bytes([KISS.CMD_DATA])+KISS.escape(raw)+bytes([KISS.FEND])
else: frame = bytes([HDLC.FLAG])+HDLC.escape(raw)+bytes([HDLC.FLAG])
self.socket.sendall(frame)
self.txb += len(frame)
@ -803,6 +805,7 @@ class I2PInterface(Interface):
thread.daemon = True
thread.start()
def final_init(self):
if self.connectable:
def tunnel_job():
while True:

View file

@ -167,6 +167,7 @@ class Interface:
self.egress_control = RNS.Reticulum.get_instance()._default_egress_control()
self.announce_queue = []
self.held_announces = {}
self.ifac_identity = None
self.transmit_buffer = None
self.ia_freq_deque = deque(maxlen=Interface.IA_FREQ_SAMPLES)

View file

@ -159,13 +159,13 @@ class TCPClientInterface(Interface):
self.connect_timeout = connect_timeout
else:
self.connect_timeout = TCPClientInterface.INITIAL_CONNECT_TIMEOUT
if TCPClientInterface.SYNCHRONOUS_START:
self.initial_connect()
else:
thread = threading.Thread(target=self.initial_connect)
thread.daemon = True
thread.start()
def final_init(self):
if TCPClientInterface.SYNCHRONOUS_START: self.initial_connect()
else:
thread = threading.Thread(target=self.initial_connect)
thread.daemon = True
thread.start()
def initial_connect(self):
if not self.connect(initial=True):
@ -230,9 +230,11 @@ class TCPClientInterface(Interface):
def early_synthesis(self, packet):
if not self.detached:
if not packet.packed: packet.pack()
if self.ifac_identity: raw = RNS.Transport.handle_outgoing_ifac(self, packet.raw);
else: raw = packet.raw
if self.kiss_framing: frame = bytes([KISS.FEND])+bytes([KISS.CMD_DATA])+KISS.escape(packet.raw)+bytes([KISS.FEND])
else: frame = bytes([HDLC.FLAG])+HDLC.escape(packet.raw)+bytes([HDLC.FLAG])
if self.kiss_framing: frame = bytes([KISS.FEND])+bytes([KISS.CMD_DATA])+KISS.escape(raw)+bytes([KISS.FEND])
else: frame = bytes([HDLC.FLAG])+HDLC.escape(raw)+bytes([HDLC.FLAG])
self.socket.sendall(frame)
self.txb += len(frame)