Ignore prepended all-zero hops when calculating max flood hops#2745
Open
vaizki wants to merge 1 commit into
Open
Ignore prepended all-zero hops when calculating max flood hops#2745vaizki wants to merge 1 commit into
vaizki wants to merge 1 commit into
Conversation
75c6876 to
64b07a7
Compare
64b07a7 to
7dee23f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
Packet::getPathHashCountExcludingLeadingZeros()and uses it for flood forwarding policy checks. Leading all-zero path entries are treated as synthetic padding for all flood max decisions, while the existing rawPacket::getPathHashCount()behavior is left unchanged for path encoding, append position, priority, and the 64-byte path capacity check.Motivation
For sensor telemetry, I want to send flood-routed packets but limit how far they propagate. MeshCore does not have a TTL field, but flood routing already stops when another repeater hash no longer fits in
Packet::path(64 bytes). So I am abusing this length limit by prefilling the route with reserved values (zeros). This already works without this PR.With the new flood max config options (all, unscoped, adverts) it's expected that flood propagation will be limited by repeater admins by using these knobs to cut down on flood from lands far away. However this will completely kill the prepending zeros trick. Thus this PR to ignore prepended all-zero IDs in paths when counting for the max hop limiters.
Other use cases
It's a generic TTL mechanism. Use it to limit all kinds of flood packets . This PR targets only the routing part, not actual applications in companions / sensors etc.
Other solutions considered
Example
Example with 3-byte path hashes:
Behavior
Patched firmware:
Existing 1.14.0+ firmware:
parses the multibyte path normally;
counts the synthetic entries as normal hops for flood.max;
still honors the raw path capacity limit;
may drop early if its configured flood.max is lower than the prefilled count.
Adverse side-effects
Scope of changes
This does not change the wire format,
Packet::readFrom(),Dispatcher::tryParsePacket(), or direct routing. It only changes flood policy accounting in the repeater/room-server/sensor forwarding checks.