Skip to content

Fix replies dropped when flood.max.unscoped is low - #3106

Open
ViezeVingertjes wants to merge 2 commits into
meshcore-dev:devfrom
ViezeVingertjes:fix/scoped-reply-routing
Open

Fix replies dropped when flood.max.unscoped is low#3106
ViezeVingertjes wants to merge 2 commits into
meshcore-dev:devfrom
ViezeVingertjes:fix/scoped-reply-routing

Conversation

@ViezeVingertjes

Copy link
Copy Markdown
Contributor

The repeater ignores the return path it already has, for logins only.
onPeerDataRecv checks client->out_path_len before falling back to flooding a REQ
reply. onAnonDataRecv never did: it only looked at reply_path_len, which
handleLoginReq does not set. A login arriving DIRECT is therefore always answered by
flooding, even when the repeater holds a valid out_path for that client.
simple_room_server already had this check; only the repeater was missing it.

Flooded replies go out un-scoped. A DIRECT request carries no transport codes, so
recv_pkt_region is NULL and sendFloodReply fell through to sendFlood(). Under
flood.max.unscoped=0 that reply dies at hop 0. Under the shipped default of 64 it
instead propagates across the whole mesh, which accounts for a lot of the REQ/RESP
flood traffic operators are seeing.

Changes

  • chooseReplyRoute(): a login arriving DIRECT replies via the client's stored
    out_path, matching what every other request type already does.
  • chooseReplyScope(): when the requester's scope cannot be determined, reply in the
    node's default Region instead of un-scoped. An un-scoped flood request is still
    answered un-scoped, so paths that work today are unchanged.
  • Both are pure functions in src/helpers/RoutingPolicy.h, alongside
    isFloodHopLimitExceeded() extracted from the copy in each firmware.
  • 14 unit tests in test/test_routing_policy/.

- Le Claude 🤖

@ViezeVingertjes
ViezeVingertjes marked this pull request as ready for review August 4, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant