feat: VLAN-style region tagging for untagged flood packets#2073
feat: VLAN-style region tagging for untagged flood packets#2073dale-ruane wants to merge 7 commits intomeshcore-dev:devfrom
Conversation
Repeaters with a home region configured now automatically tag untagged flood packets (ROUTE_TYPE_FLOOD) with the home region's transport code, converting them to ROUTE_TYPE_TRANSPORT_FLOOD. Also adds TRANSPORT_CODE_ALL (0xFFFF) as a reserved code that bypasses region filtering, allowing mesh-wide flooding when explicitly requested.
|
@weebl2000 @ViezeVingertjes could someone please review this? it's a very important improvement to the way scoping works, which allows for a gentler and more flexible adoption of regions. |
ViezeVingertjes
left a comment
There was a problem hiding this comment.
Looks good, and imho it does make sense to have this.
Just a sanity check; Did you check if any documentation requires an update for this change?
|
It definitely needs good docs, it's a new feature. IMHO docs on regions need to be beefed up anyway, explaining the concepts and not just the config syntax. |
|
I think this is the best way to bootstrap region use adoption. |
|
It looks like this also solves PR1810 "Allow direct message paths when denyf * is set" Because |
|
Should there be a new repeater CLI setting boolean to control this behaviour? Even though not setting a home region is a defacto way of turning it off, it should probably be explicit. |
|
Just thinking about this a little more, especially in the case where a "boundary" repeater can hear nodes in other regions it is essential that the choice of home region is correct so that unscoped flood packets are not tagged with an incorrect region. For this reason I think there should be a new repeater setting for this feature and the default being off, as the choice of home region requires the repeater admin to think carefully about the intended behaviour. To that end, it will be important for the Local example using the Pacific Northwest MeshCore Region Strategy and a repeater on Mt Baker, Whatcom County, WA USA. The physical location of the repeater would be Writing this now, it seems like it might actually be better to only apply this to a configurable number of hops to avoid tagging flood packets that originated in distant regions and were forwarded by repeaters that did not have unscoped tagging turned on (or older firmwares that wouldn't support it). I see that In other words, the repeater admin must know what geographical area they will receive flood packets from in order to choose the correct home region. |
|
This definitely needs some thought, repeater operators opting in seems like a good idea outside just setting the home region. I myself would be against tagging traffic for a repeater between two regions as the pnw region. That's way to wide of a scope to auto-tag traffic, it may as well be * at that point. I do think there should be a auto-tag max hop setting where a repeater operator can tone down the auto tagging depending on where the repeater is located and what it hears. If scoping at a sub-region or state level, going up to 3 or 4 hops may make sense, while other areas even a zero hop will have some mis-tag issues. Allowing the admin to tune for best affect I think is most practical. Despite the above controls, some situations will not be fully be able to control 100% accuracy of the auto tagging. At some point it'll need to boil down to If originators want their traffic tagged correctly, they need to configure the region scope for their traffic at origination. |
|
Yeah, the more I think about it, a repeater admin can't be expected to know the geographical reach even 1 or 2 hops out, it's hard enough to keep track of the location your own (direct, zero hop) contacts over time. I think it auto-scoping should only be applied if the new setting is on and |
|
I agree that this limit is useful but let's make it configurable with the default 1 or 2. I know that in my area's topology no harm would be done even with 2-3. EDIT: and we have to document it really well :) |
Adds two new repeater prefs to give admins explicit control over VLAN-style region tagging of untagged flood packets: region.autotag on|off (default: off) region.autotag.max.hops 0-8 (default: 1) Auto-tagging now only occurs when the setting is enabled AND the received packet's path hash count is <= the configured max hops. This prevents mis-tagging distant-origin floods that arrived via untagged / older-firmware repeaters, and ensures home-region selection is a deliberate admin decision rather than an implicit side-effect of configuring a home region.
|
Great suggestions all - I've added the opt-in and hop-limit. Docs coming in the next commit. Would appreciate feedback on the Docs and commit above |
Adds CLI reference entries for the new region.autotag and region.autotag.max.hops settings, and expands the region home documentation with guidance on how to choose a home region so that auto-tagged flood packets are scoped correctly. Also notes the reserved TRANSPORT_CODE_ALL (0xFFFF) bypass behaviour.
- Drop VLAN analogy; describe the behaviour directly so the docs stand on their own. - Clarify region.autotag.max.hops value description to refer to "packets without scope" explicitly.
| #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.
Client apps will need to support sending packets with this code, which is different from sending without a scope. @liamcottle
There was a problem hiding this comment.
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
Clarify that with no home region configured, auto-tagging is effectively disabled regardless of the region.autotag setting, and untagged floods fall back to the wildcard region's flood permission.
Replace the magic 8 used in both the load-time sanitize and the CLI set handler with REGION_AUTOTAG_MAX_HOPS_LIMIT, and surface the cap in the "Error, range is 0-N" reply so the CLI and the constant can never drift apart. Also expand the docs to call out the range explicitly, the clamp-on- load behaviour, and the rationale for the 8 upper bound (well below flood.max so auto-tagging can't silently scope distant traffic).
| - `value`: Maximum path hash count (0-8). `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. | ||
| - `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. |
|
OK, the TRANSPORT_CODE_ALL doesn't make much sense, to me. It's yet another rule change that would take time to percolate around with firmware version updates. And there already a rule that covers it (well, repeaters that allow un-scoped). Also, strikes me as something that would be abused, ie. if repeaters will all allow 0xFFFF ? Also, auto-assigning the home region for un-scoped, seems more like a work-around for the current problem of most clients sending un-scoped floods (eg. for DM's, logins, requests, etc). But, this should soon be solved with the 'default scope' feature. (currently in the default-scope branch) |
Summary
Closes #2041
ROUTE_TYPE_FLOOD) with the home region's transport code, converting them toROUTE_TYPE_TRANSPORT_FLOODTRANSPORT_CODE_ALL(0xFFFF) as a reserved code that bypasses region filtering, allowing mesh-wide flooding when explicitly requestedHow it works
Similar to VLAN tagging in networking:
Test plan
TRANSPORT_CODE_ALLpackets are forwarded by all repeaters