MeshCore Path Discovery Deep Dive
MeshCore's path-based routing is what distinguishes it from Meshtastic's flooding approach. Understanding the path discovery mechanism in detail helps you design networks that route efficiently and troubleshoot delivery failures.
RREQ and RREP: The Discovery Handshake
When Node A wants to send a message to Node B and has no known path:
Step 1: Route Request (RREQ)
Node A broadcasts an RREQ packet containing:
- Source node ID (A)
- Destination node ID (B)
- Request sequence number (prevents duplicate handling)
- Path accumulator (starts empty)
Each node that receives the RREQ appends its own ID to the path accumulator and rebroadcasts the packet (up to the TTL/hop limit). This means when the RREQ arrives at Node B, it carries a complete record of the path it traversed: [A → C → D → B].
Step 2: Route Reply (RREP)
Node B sends an RREP back along the reverse of the discovered path. The RREP contains the complete path [B → D → C → A]. Each intermediate node receives the RREP, learns the path, and unicasts it to the next node toward A.
When Node A receives the RREP, it now knows the full path to B: [A → C → D → B]. It stores this in its route cache and uses it for all subsequent messages to B (without another RREQ).
Route Cache Lifetime
Discovered routes are cached for a configurable time period. If no packet has been sent on a route within the cache lifetime, the route expires and a new RREQ is triggered on the next message:
- Too short: Frequent RREQ floods as routes expire, wasting bandwidth
- Too long: Stale routes to nodes that have moved or gone offline, causing delivery failures
MeshCore's default route cache lifetime is optimized for infrastructure nodes that move infrequently. For mobile nodes, route expiry happens faster (triggered when the route fails).
Route Failure and Recovery
When a packet fails delivery on a known route (ACK timeout), MeshCore handles it in two stages:
- Immediate retry: One or two retransmissions on the same route
- Route invalidation: If retries fail, the route is marked invalid and a new RREQ is issued
- RERR (Route Error): The intermediate node that detected the failure may broadcast an RERR packet, informing other nodes to remove this route from their caches
This means a node failure is detected and routed around within 2-5 message exchanges — much faster than waiting for the route cache to naturally expire.
Why This Scales Better Than Flooding
Consider a 30-node network where Node A sends one message to Node B:
| Approach | Initial Discovery | Subsequent Messages |
|---|---|---|
| Meshtastic flooding | ~30 retransmissions | ~30 retransmissions per message (always floods) |
| MeshCore path routing | ~30 retransmissions (RREQ discovery) | ~3-4 unicast packets (only on path) |
For a 30-node network with 10 active pairs sending messages, Meshtastic generates 300 air transmissions per message round; MeshCore generates 30-40. In a 200-node network, this difference becomes dramatic: Meshtastic floods the channel while MeshCore maintains responsive delivery.
No comments to display
No comments to display