mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Added roaming and boundary interface modes
This commit is contained in:
parent
4b38a776a3
commit
8636259886
@ -34,6 +34,8 @@ class Interface:
|
|||||||
MODE_FULL = 0x01
|
MODE_FULL = 0x01
|
||||||
MODE_POINT_TO_POINT = 0x02
|
MODE_POINT_TO_POINT = 0x02
|
||||||
MODE_ACCESS_POINT = 0x03
|
MODE_ACCESS_POINT = 0x03
|
||||||
|
MODE_ROAMING = 0x04
|
||||||
|
MODE_BOUNDARY = 0x05
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.rxb = 0
|
self.rxb = 0
|
||||||
|
@ -343,20 +343,30 @@ class Reticulum:
|
|||||||
interface_mode = Interface.Interface.MODE_FULL
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
if "interface_mode" in c:
|
if "interface_mode" in c:
|
||||||
|
c["interface_mode"] = str(c["interface_mode"]).lower()
|
||||||
if c["interface_mode"] == "full":
|
if c["interface_mode"] == "full":
|
||||||
interface_mode = Interface.Interface.MODE_FULL
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
elif c["interface_mode"] == "access_point" or c["interface_mode"] == "accesspoint" or c["interface_mode"] == "ap":
|
elif c["interface_mode"] == "access_point" or c["interface_mode"] == "accesspoint" or c["interface_mode"] == "ap":
|
||||||
interface_mode = Interface.Interface.MODE_ACCESS_POINT
|
interface_mode = Interface.Interface.MODE_ACCESS_POINT
|
||||||
elif c["interface_mode"] == "pointtopoint" or c["interface_mode"] == "ptp":
|
elif c["interface_mode"] == "pointtopoint" or c["interface_mode"] == "ptp":
|
||||||
interface_mode = Interface.Interface.MODE_POINT_TO_POINT
|
interface_mode = Interface.Interface.MODE_POINT_TO_POINT
|
||||||
|
elif c["interface_mode"] == "roaming":
|
||||||
|
interface_mode = Interface.Interface.MODE_ROAMING
|
||||||
|
elif c["interface_mode"] == "boundary":
|
||||||
|
interface_mode = Interface.Interface.MODE_BOUNDARY
|
||||||
|
|
||||||
elif "mode" in c:
|
elif "mode" in c:
|
||||||
|
c["mode"] = str(c["mode"]).lower()
|
||||||
if c["mode"] == "full":
|
if c["mode"] == "full":
|
||||||
interface_mode = Interface.Interface.MODE_FULL
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
elif c["mode"] == "access_point" or c["mode"] == "accesspoint" or c["mode"] == "ap":
|
elif c["mode"] == "access_point" or c["mode"] == "accesspoint" or c["mode"] == "ap":
|
||||||
interface_mode = Interface.Interface.MODE_ACCESS_POINT
|
interface_mode = Interface.Interface.MODE_ACCESS_POINT
|
||||||
elif c["mode"] == "pointtopoint" or c["mode"] == "ptp":
|
elif c["mode"] == "pointtopoint" or c["mode"] == "ptp":
|
||||||
interface_mode = Interface.Interface.MODE_POINT_TO_POINT
|
interface_mode = Interface.Interface.MODE_POINT_TO_POINT
|
||||||
|
elif c["mode"] == "roaming":
|
||||||
|
interface_mode = Interface.Interface.MODE_ROAMING
|
||||||
|
elif c["mode"] == "boundary":
|
||||||
|
interface_mode = Interface.Interface.MODE_BOUNDARY
|
||||||
|
|
||||||
ifac_size = None
|
ifac_size = None
|
||||||
if "ifac_size" in c:
|
if "ifac_size" in c:
|
||||||
|
@ -58,6 +58,7 @@ class Transport:
|
|||||||
PATHFINDER_RW = 0.5 # Random window for announce rebroadcast
|
PATHFINDER_RW = 0.5 # Random window for announce rebroadcast
|
||||||
PATHFINDER_E = 60*60*24*7 # Path expiration of one week
|
PATHFINDER_E = 60*60*24*7 # Path expiration of one week
|
||||||
AP_PATH_TIME = 60*60*24 # Path expiration of one day for Access Point paths
|
AP_PATH_TIME = 60*60*24 # Path expiration of one day for Access Point paths
|
||||||
|
ROAMING_PATH_TIME = 60*60*6 # Path expiration of 6 hours for Roaming paths
|
||||||
|
|
||||||
# TODO: Calculate an optimal number for this in
|
# TODO: Calculate an optimal number for this in
|
||||||
# various situations
|
# various situations
|
||||||
@ -576,6 +577,29 @@ class Transport:
|
|||||||
RNS.log("Blocking announce broadcast on "+str(interface)+" due to AP mode", RNS.LOG_EXTREME)
|
RNS.log("Blocking announce broadcast on "+str(interface)+" due to AP mode", RNS.LOG_EXTREME)
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
|
|
||||||
|
elif interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||||
|
from_interface = Transport.next_hop_interface(packet.destination_hash)
|
||||||
|
if from_interface == None or not hasattr(from_interface, "mode"):
|
||||||
|
RNS.log("Blocking announce broadcast on "+str(interface)+" since next hop interface is non-existing or has no mode configured", RNS.LOG_EXTREME)
|
||||||
|
should_transmit = False
|
||||||
|
else:
|
||||||
|
if from_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||||
|
RNS.log("Blocking announce broadcast on "+str(interface)+" due to roaming-mode next-hop interface", RNS.LOG_EXTREME)
|
||||||
|
should_transmit = False
|
||||||
|
elif from_interface.mode == RNS.Interfaces.Interface.Interface.MODE_BOUNDARY:
|
||||||
|
RNS.log("Blocking announce broadcast on "+str(interface)+" due to boundary-mode next-hop interface", RNS.LOG_EXTREME)
|
||||||
|
should_transmit = False
|
||||||
|
|
||||||
|
elif interface.mode == RNS.Interfaces.Interface.Interface.MODE_BOUNDARY:
|
||||||
|
from_interface = Transport.next_hop_interface(packet.destination_hash)
|
||||||
|
if from_interface == None or not hasattr(from_interface, "mode"):
|
||||||
|
RNS.log("Blocking announce broadcast on "+str(interface)+" since next hop interface is non-existing or has no mode configured", RNS.LOG_EXTREME)
|
||||||
|
should_transmit = False
|
||||||
|
else:
|
||||||
|
if from_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||||
|
RNS.log("Blocking announce broadcast on "+str(interface)+" due to roaming-mode next-hop interface", RNS.LOG_EXTREME)
|
||||||
|
should_transmit = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Currently, annouces originating locally are always
|
# Currently, annouces originating locally are always
|
||||||
# allowed, and do not conform to bandwidth caps.
|
# allowed, and do not conform to bandwidth caps.
|
||||||
@ -1080,6 +1104,8 @@ class Transport:
|
|||||||
|
|
||||||
if packet.receiving_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT:
|
if packet.receiving_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT:
|
||||||
expires = now + Transport.AP_PATH_TIME
|
expires = now + Transport.AP_PATH_TIME
|
||||||
|
elif packet.receiving_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||||
|
expires = now + Transport.ROAMING_PATH_TIME
|
||||||
else:
|
else:
|
||||||
expires = now + Transport.PATHFINDER_E
|
expires = now + Transport.PATHFINDER_E
|
||||||
|
|
||||||
|
@ -71,6 +71,10 @@ def program_setup(configdir, dispall=False, verbosity = 0):
|
|||||||
modestr = "Access Point"
|
modestr = "Access Point"
|
||||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_POINT_TO_POINT:
|
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_POINT_TO_POINT:
|
||||||
modestr = "Point-to-Point"
|
modestr = "Point-to-Point"
|
||||||
|
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||||
|
modestr = "Roaming"
|
||||||
|
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_BOUNDARY:
|
||||||
|
modestr = "Boundary"
|
||||||
else:
|
else:
|
||||||
modestr = "Full"
|
modestr = "Full"
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = "0.3.5"
|
__version__ = "0.3.6"
|
||||||
|
Loading…
Reference in New Issue
Block a user