-
Notifications
You must be signed in to change notification settings - Fork 753
feat: VLAN-style region tagging for untagged flood packets #2073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
85a3b1d
d93746e
c9f08e5
44c7023
a06984b
e5d9eb7
b2d8039
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -712,6 +712,40 @@ This document provides an overview of CLI commands that can be sent to MeshCore | |
| **Parameters:** | ||
| - `name`: Region name | ||
|
|
||
| **Note:** The home region is used by the auto-tag feature (see `region.autotag` below) to stamp a transport code onto untagged flood packets this repeater receives, converting them from `ROUTE_TYPE_FLOOD` to `ROUTE_TYPE_TRANSPORT_FLOOD`. When selecting a home region, choose the **most specific region in the local region hierarchy that includes all nodes this repeater can possibly hear** (including via hops you intend to cover — see `region.autotag.max.hops`). Choosing a home region that is too narrow will cause unscoped packets originating from neighbouring regions to be tagged incorrectly; choosing one that is too broad defeats the purpose of scoping. | ||
|
|
||
| **When no home region is set:** the repeater has no scope to apply, so auto-tagging is effectively disabled regardless of the `region.autotag` setting — untagged flood packets are forwarded based on the wildcard (`*`) region's flood permission only. To participate in auto-tagging, both a home region must be configured here **and** `region.autotag` must be `on`. | ||
|
|
||
| --- | ||
|
|
||
| #### View or change whether this repeater auto-tags untagged flood packets | ||
| **Usage:** | ||
| - `get region.autotag` | ||
| - `set region.autotag <state>` | ||
|
|
||
| **Parameters:** | ||
| - `state`: `on` (enable) or `off` (disable) | ||
|
|
||
| **Default:** `off` | ||
|
|
||
| **Note:** When enabled, the repeater stamps its home region's transport code onto untagged flood packets (`ROUTE_TYPE_FLOOD`) it receives, converting them to `ROUTE_TYPE_TRANSPORT_FLOOD` before re-broadcast. This scopes legacy / un-scoped traffic into the configured home region, but requires a home region to be configured (see `region home`). Because mis-tagging is possible when the repeater can hear traffic originating outside its home region, this feature is opt-in. See also `region.autotag.max.hops` to limit how far a packet may have travelled before becoming eligible for auto-tagging. The reserved transport code `0xFFFF` (TRANSPORT_CODE_ALL) is always forwarded regardless of local region configuration, allowing explicit mesh-wide flooding when a sender requests it. | ||
|
|
||
| --- | ||
|
|
||
| #### View or change the max hop count for auto-tagging | ||
| **Usage:** | ||
| - `get region.autotag.max.hops` | ||
| - `set region.autotag.max.hops <value>` | ||
|
|
||
| **Parameters:** | ||
| - `value`: Maximum path hash count. `0` means only auto-tag packets without scope received directly (zero-hop); higher values also auto-tag packets without scope that already traversed that many repeaters. | ||
|
|
||
| **Range:** `0` to `8` (inclusive). Values outside this range are rejected by `set` and clamped to this range on load. The upper bound of `8` is intentionally well below the default `flood.max` of `64`, because auto-tagging packets from far across the mesh almost always produces incorrect region assignments — the limit exists to keep admins honest about the geographic scope they can actually account for. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, nice. |
||
|
|
||
| **Default:** `1` | ||
|
|
||
| **Note:** Only applies when `region.autotag` is `on`. Keep this small (0-2) unless you are certain no untagged / older-firmware repeaters exist within that many hops, otherwise distant-origin traffic forwarded through them may be tagged with the wrong region. | ||
|
|
||
| --- | ||
|
|
||
| #### Create a new region | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ namespace mesh { | |
| #define ROUTE_TYPE_DIRECT 0x02 // direct route, 'path' is supplied | ||
| #define ROUTE_TYPE_TRANSPORT_DIRECT 0x03 // direct route + transport codes | ||
|
|
||
| #define TRANSPORT_CODE_ALL 0xFFFF // special transport code: forward to all regions | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Client apps will need to support sending packets with this code, which is different from sending without a scope. @liamcottle
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I had hoped that maybe this could be implemented in the client apps. Perhaps a one-time toggle for a message which then reverts? Just to gently encourage people not to just scope every message to all
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm against '0xFFFF'; that can way to easily be abused to DDOS the whole network. I'd say a large region can decide on their own whether to agree on a region wide flood code for emergencies or not. |
||
|
|
||
| #define PAYLOAD_TYPE_REQ 0x00 // request (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob) | ||
| #define PAYLOAD_TYPE_RESPONSE 0x01 // response to REQ or ANON_REQ (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob) | ||
| #define PAYLOAD_TYPE_TXT_MSG 0x02 // a plain text message (prefixed with dest/src hashes, MAC) (enc data: timestamp, text) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.