mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-07-10 18:48:11 -07:00
Added internal interface mode
This commit is contained in:
@@ -48,10 +48,11 @@ class Interface:
|
||||
MODE_ROAMING = 0x04
|
||||
MODE_BOUNDARY = 0x05
|
||||
MODE_GATEWAY = 0x06
|
||||
MODE_INTERNAL = 0x07
|
||||
|
||||
# Which interface modes a Transport Node should
|
||||
# actively discover paths for.
|
||||
DISCOVER_PATHS_FOR = [MODE_ACCESS_POINT, MODE_GATEWAY, MODE_ROAMING]
|
||||
DISCOVER_PATHS_FOR = [MODE_ACCESS_POINT, MODE_GATEWAY, MODE_ROAMING, MODE_INTERNAL]
|
||||
|
||||
# How many samples to use for announce
|
||||
# frequency calculations
|
||||
|
||||
@@ -710,6 +710,8 @@ class Reticulum:
|
||||
interface_mode = Interface.Interface.MODE_BOUNDARY
|
||||
elif c["mode"] == "gateway" or c["mode"] == "gw":
|
||||
interface_mode = Interface.Interface.MODE_GATEWAY
|
||||
elif c["mode"] == "internal":
|
||||
interface_mode = Interface.Interface.MODE_INTERNAL
|
||||
|
||||
elif "mode" in c:
|
||||
c["mode"] = str(c["mode"]).lower()
|
||||
@@ -725,6 +727,8 @@ class Reticulum:
|
||||
interface_mode = Interface.Interface.MODE_BOUNDARY
|
||||
elif c["mode"] == "gateway" or c["mode"] == "gw":
|
||||
interface_mode = Interface.Interface.MODE_GATEWAY
|
||||
elif c["mode"] == "internal":
|
||||
interface_mode = Interface.Interface.MODE_INTERNAL
|
||||
|
||||
ifac_size = None
|
||||
if "ifac_size" in c:
|
||||
|
||||
@@ -1196,6 +1196,22 @@ class Transport:
|
||||
RNS.log("Blocking announce broadcast on "+str(interface)+" due to AP mode", RNS.LOG_EXTREME) if RNS.sl(RNS.LOG_EXTREME) else None
|
||||
should_transmit = False
|
||||
|
||||
elif interface.mode == RNS.Interfaces.Interface.Interface.MODE_INTERNAL:
|
||||
from_interface = Transport.next_hop_interface(packet.destination_hash)
|
||||
if from_interface == None or not hasattr(from_interface, "mode"):
|
||||
should_transmit = False
|
||||
if from_interface == None:
|
||||
RNS.log("Blocking announce broadcast on "+str(interface)+" since next hop interface doesn't exist", RNS.LOG_EXTREME) if RNS.sl(RNS.LOG_EXTREME) else None
|
||||
elif not hasattr(from_interface, "mode"):
|
||||
RNS.log("Blocking announce broadcast on "+str(interface)+" since next hop interface has no mode configured", RNS.LOG_EXTREME) if RNS.sl(RNS.LOG_EXTREME) else None
|
||||
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) if RNS.sl(RNS.LOG_EXTREME) else None
|
||||
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) if RNS.sl(RNS.LOG_EXTREME) else None
|
||||
should_transmit = False
|
||||
|
||||
elif interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING:
|
||||
local_destination = None
|
||||
with Transport.destinations_map_lock:
|
||||
|
||||
@@ -423,6 +423,7 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_ROAMING: modestr = "Roaming"
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_BOUNDARY: modestr = "Boundary"
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_GATEWAY: modestr = "Gateway"
|
||||
elif ifstat["mode"] == RNS.Interfaces.Interface.Interface.MODE_INTERNAL: modestr = "Internal"
|
||||
else: modestr = "Full"
|
||||
|
||||
|
||||
|
||||
@@ -1291,6 +1291,15 @@ the default mode.
|
||||
public Transport Node available on the Internet, the interface
|
||||
connecting over the Internet should be set to ``boundary`` mode.
|
||||
|
||||
* | The ``internal`` mode designates interfaces that belong to an
|
||||
network different from any marked as ``boundary``. Announces from
|
||||
a ``boundary`` interface will not propagate to interfaces set as
|
||||
``internal``, but announces *will* propagate from ``internal`` *to*
|
||||
``boundary``. Devices on the ``internal`` side of the network will
|
||||
still be able to resolve paths to destinations across the boundary
|
||||
when needed, since recursive path requests are enabled for ``internal``
|
||||
mode interfaces by default.
|
||||
|
||||
For a table describing the impact of all modes on announce propagation,
|
||||
please see the :ref:`Announce Propagation Rules<understanding-announcepropagation>` section.
|
||||
|
||||
|
||||
@@ -714,23 +714,33 @@ See the :ref:`Interface Modes<interfaces-modes>` section for a conceptual overvi
|
||||
..
|
||||
(.. code-block:: text)
|
||||
Full ────── ✓ ──┐ ┌── ✓ ── Full
|
||||
AP ──────── ✓ ──┼───> Full >───┼── ✕ ── AP
|
||||
Boundary ── ✓ ──┤ ├── ✓ ── Boundary
|
||||
AP ──────── ✓ ──┤ ├── ✕ ── AP
|
||||
Boundary ── ✓ ──┼───> Full >───┼── ✓ ── Boundary
|
||||
Internal ── ✓ ──┤ ├── ✓ ── Internal
|
||||
Roaming ─── ✓ ──┘ └── ✓ ── Roaming
|
||||
|
||||
Full ────── ✕ ──┐ ┌── ✓ ── Full
|
||||
AP ──────── ✕ ──┼────> AP >────┼── ✕ ── AP
|
||||
Boundary ── ✕ ──┤ ├── ✓ ── Boundary
|
||||
AP ──────── ✕ ──┤ ├── ✕ ── AP
|
||||
Boundary ── ✕ ──┼────> AP >────┼── ✓ ── Boundary
|
||||
Internal ── ✕ ──┤ ├── ✓ ── Internal
|
||||
Roaming ─── ✕ ──┘ └── ✓ ── Roaming
|
||||
|
||||
Full ────── ✓ ──┐ ┌── ✓ ── Full
|
||||
AP ──────── ✓ ──┼─> Roaming >──┼── ✕ ── AP
|
||||
Boundary ── ✕ ──┤ ├── ✕ ── Boundary
|
||||
AP ──────── ✓ ──┤ ├── ✕ ── AP
|
||||
Boundary ── ✕ ──┼─> Roaming >──┼── ✕ ── Boundary
|
||||
Internal ── ✕ ──┤ ├── ✕ ── Internal
|
||||
Roaming ─── ✕ ──┘ └── ✕ ── Roaming
|
||||
|
||||
Full ────── ✓ ──┐ ┌── ✓ ── Full
|
||||
AP ──────── ✓ ──┼─> Boundary >─┼── ✕ ── AP
|
||||
Boundary ── ✓ ──┤ ├── ✓ ── Boundary
|
||||
AP ──────── ✓ ──┤ ├── ✕ ── AP
|
||||
Boundary ── ✓ ──┼─> Boundary >─┼── ✓ ── Boundary
|
||||
Internal ── ✓ ──┤ ├── ✕ ── Internal
|
||||
Roaming ─── ✕ ──┘ └── ✕ ── Roaming
|
||||
|
||||
Full ────── ✓ ──┐ ┌── ✓ ── Full
|
||||
AP ──────── ✓ ──┤ ├── ✕ ── AP
|
||||
Boundary ── ✕ ──┼─> Internal >─┼── ✓ ── Boundary
|
||||
Internal ── ✓ ──┤ ├── ✓ ── Internal
|
||||
Roaming ─── ✕ ──┘ └── ✕ ── Roaming
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user