Skip to content

Commit

Permalink
Added link MTU discovery configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jan 13, 2025
1 parent 89d5d95 commit c6576d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RNS/Link.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def __init__(self, destination=None, established_callback = None, closed_callbac
if self.initiator:
link_mtu = b""
nh_hw_mtu = RNS.Transport.next_hop_interface_hw_mtu(destination.hash)
if RNS.Reticulum.LINK_MTU_DISCOVERY and nh_hw_mtu:
if RNS.Reticulum.link_mtu_discovery() and nh_hw_mtu:
link_mtu = Link.mtu_bytes(nh_hw_mtu)
RNS.log(f"Signalling link MTU of {RNS.prettysize(nh_hw_mtu)} for link", RNS.LOG_DEBUG) # TODO: Remove debug
self.request_data = self.pub_bytes+self.sig_pub_bytes+link_mtu
Expand Down
19 changes: 19 additions & 0 deletions RNS/Reticulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def __init__(self,configdir=None, loglevel=None, logdest=None, verbosity=None, r
Reticulum.interfacepath = Reticulum.configdir+"/interfaces"

Reticulum.__transport_enabled = False
Reticulum.__link_mtu_discovery = Reticulum.LINK_MTU_DISCOVERY
Reticulum.__remote_management_enabled = False
Reticulum.__use_implicit_proof = True
Reticulum.__allow_probes = False
Expand Down Expand Up @@ -433,6 +434,10 @@ def __apply_config(self):
v = self.config["reticulum"].as_bool(option)
if v == True:
Reticulum.__transport_enabled = True
if option == "link_mtu_discovery":
v = self.config["reticulum"].as_bool(option)
if v == True:
Reticulum.__link_mtu_discovery = True
if option == "enable_remote_management":
v = self.config["reticulum"].as_bool(option)
if v == True:
Expand Down Expand Up @@ -1238,6 +1243,20 @@ def transport_enabled():
"""
return Reticulum.__transport_enabled

@staticmethod
def link_mtu_discovery():
"""
Returns whether link MTU discovery is enabled for the running
instance.
When link MTU discovery is enabled, Reticulum will
automatically upgrade link MTUs to the highest supported
value, increasing transfer speed and efficiency.
:returns: True if link MTU discovery is enabled, False if not.
"""
return Reticulum.__link_mtu_discovery

@staticmethod
def remote_management_enabled():
"""
Expand Down

0 comments on commit c6576d6

Please sign in to comment.