# MeshCore Routing: Flood-First, Direct-Route-After

This page describes MeshCore's routing mechanism as verified from `docs/packet_format.md` (for the packet/route-type structure) and the firmware source and CLI docs (for the routing behaviour) in the official MeshCore repository. Note: MeshCore's hybrid flood/direct scheme is not the AODV protocol - earlier versions of this page incorrectly used AODV terminology (path discovery/acknowledgment), which does not match how MeshCore works.

## How MeshCore Routing Actually Works

MeshCore uses a **flood-first, direct-route-after** mechanism:

### Step 1: Flood Routing (First Message)

When a node sends a message to a destination it has no path for, the packet uses `ROUTE_TYPE_FLOOD`. Every repeater in range re-broadcasts the packet (subject to flood limits); Companion/client nodes do not repeat. The destination node receives the message through whatever path it arrived on.

### Step 2: Path Return

The destination node responds by sending back a `PAYLOAD_TYPE_PATH` packet. This packet contains the complete list of repeaters through which the original flooded message arrived. The path travels back to the original sender.

### Step 3: Direct Routing (Subsequent Messages)

Armed with the learned path, the sender now uses `ROUTE_TYPE_DIRECT` for subsequent messages. The packet embeds the repeater list, and **only those specific repeaters forward it**. All other repeaters ignore the packet entirely.

## Why This Is More Efficient Than Pure Flooding

- After the initial flood, all subsequent messages in a conversation use direct routing - dramatically less channel airtime
- A busy network with many established conversations generates far less channel overhead than a pure flood mesh
- Path re-learning happens automatically if a direct-routed message fails (falls back to flood)

## Route Types Reference

<table id="bkmrk-route-typewhen-used-"><thead><tr><th>Route Type</th><th>When Used</th></tr></thead><tbody><tr><td>`ROUTE_TYPE_FLOOD`</td><td>Initial contact; all group/channel messages</td></tr><tr><td>`ROUTE_TYPE_DIRECT`</td><td>Point-to-point after path is known</td></tr><tr><td>`ROUTE_TYPE_TRANSPORT_FLOOD`</td><td>Flood with regional transport code</td></tr><tr><td>`ROUTE_TYPE_TRANSPORT_DIRECT`</td><td>Direct-routed with regional transport code</td></tr></tbody></table>

*Source: docs/packet\_format.md (route-type table and packet structure) plus the firmware source (Mesh.cpp) and CLI docs (path-return and re-learning behaviour) in the official MeshCore repository. Verified 2026-05-03.*