Added hardware MTU parameter to interfaces

This commit is contained in:
Mark Qvist 2022-05-29 15:43:50 +02:00
parent d99d31097b
commit c6df6293b2
10 changed files with 41 additions and 10 deletions

View file

@ -306,6 +306,8 @@ class I2PInterfacePeer(Interface):
def __init__(self, parent_interface, owner, name, target_i2p_dest=None, connected_socket=None, max_reconnect_tries=None):
self.rxb = 0
self.txb = 0
self.HW_MTU = 1064
self.IN = True
self.OUT = False
@ -569,7 +571,7 @@ class I2PInterfacePeer(Interface):
in_frame = True
command = KISS.CMD_UNKNOWN
data_buffer = b""
elif (in_frame and len(data_buffer) < RNS.Reticulum.MTU):
elif (in_frame and len(data_buffer) < self.HW_MTU):
if (len(data_buffer) == 0 and command == KISS.CMD_UNKNOWN):
# We only support one HDLC port for now, so
# strip off the port nibble
@ -595,7 +597,7 @@ class I2PInterfacePeer(Interface):
elif (byte == HDLC.FLAG):
in_frame = True
data_buffer = b""
elif (in_frame and len(data_buffer) < RNS.Reticulum.MTU):
elif (in_frame and len(data_buffer) < self.HW_MTU):
if (byte == HDLC.ESC):
escape = True
else:
@ -660,6 +662,9 @@ class I2PInterface(Interface):
def __init__(self, owner, name, rns_storagepath, peers, connectable = False):
self.rxb = 0
self.txb = 0
self.HW_MTU = 1064
self.online = False
self.clients = 0
self.owner = owner
@ -757,6 +762,7 @@ class I2PInterface(Interface):
spawned_interface.announce_rate_grace = self.announce_rate_grace
spawned_interface.announce_rate_penalty = self.announce_rate_penalty
spawned_interface.mode = self.mode
spawned_interface.HW_MTU = self.HW_MTU
RNS.log("Spawned new I2PInterface Peer: "+str(spawned_interface), RNS.LOG_VERBOSE)
RNS.Transport.interfaces.append(spawned_interface)
self.clients += 1