Skip to content

Commit f49dfef

Browse files
authored
Merge pull request #1 from esp32-open-mac/blog/meshing
Mesh networking blog post
2 parents 0fb34ed + 88e155d commit f49dfef

11 files changed

+106
-1
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
+++
2+
authors = ["Jasper Devreker"]
3+
title = "First exclusive feature for open ESP32 Wi-Fi stack: standards-compliant meshing"
4+
date = "2025-08-18"
5+
description = "Adding the first feature to the open-source Wi-Fi stack on ESP32 that the proprietary stack does not have: standards-compliant 802.11s mesh networking"
6+
+++
7+
8+
First, a short recap of what this project is doing: the Wi-Fi stack for the ESP32 (a popular, cheap microcontroller) is provided through a binary blob. We're trying to reverse engineer the software and hardware to build our own open-source Wi-Fi stack. This will enable features that the current, closed source ESP32 Wi-Fi implementation does not have, for example 802.11s mesh networking. It will also improve the auditability of the code. We're currently writing a new Wi-Fi stack for the ESP32 from scratch, in Rust. For more details about how we reverse engineered the hardware, see previous articles.
9+
10+
In this article, we'll talk about what mesh networking is, the existing options for it on the ESP32, why those are not ideal, and what we're doing about it.
11+
12+
# What is a mesh network
13+
14+
A standard Wi-Fi network has two types of wireless nodes: a *client* (think phone, laptop, ...) and an *access point*. Clients associate with the access point, after which they can send and receive data packets to/from the access point.
15+
The standard problem with this is that if the client moves out of range of the access point, it will lose connectivity. To help solve this, mesh networking was invented: by using mesh networking, clients can act as a sort of repeater which relay packets for other clients. That way, even clients which are not in range of the original access point, can still have internet connectivity.
16+
17+
## Regular Wi-Fi network
18+
![Regular Wi-Fi network](/images/mesh-traditional-network-architecture.jpg)
19+
20+
21+
## Mesh Wi-Fi network
22+
![Mesh Wi-Fi network](/images/mesh-esp-wifi-mesh-network-architecture.jpg)
23+
24+
# Existing solutions
25+
26+
Espressif (the company behind the ESP32) already provides several mesh implementations that use the radio peripheral on the ESP32:
27+
28+
- ESP-MESH (= ESP-WIFI-MESH)
29+
- ESP-MESH-LITE
30+
- ESP-BLE-MESH
31+
32+
## ESP-MESH
33+
34+
ESP-MESH (which they also call ESP-WIFI-MESH) is based on each ESP32 having two interfaces: one SoftAP (access point mode) interface, for downsteam connection, and one station interface for upstream connection.
35+
36+
![Topology of ESP-MESH](/images/mesh-tree-topology.jpg)
37+
38+
As you can see, the nodes in ESP-MESH have a tree topology. This is not ideal: all packets of the mesh have to go through the root node, even if other nodes are within reach of the AP.
39+
40+
ESP-MESH does not provide real IP connectivity to nodes: nodes can use a limited set of protocols to communicate with outside servers: they can set a HTTP/MQTT/JSON or raw binary payload. This message will then be sent throught the tree until it reaches the root node. The root node will then initiate an actual HTTP/MQTT/... request with the data in the packet. This rather restricts us: only the root layer has an active TCP/IP stack, so the child nodes can't use arbitary TCP/IP protocols (for example, SSH); they can only communicate in terms of HTTP/MQTT/...
41+
42+
![Mesh bidirectional stream](/images/mesh-bidirectional-data-stream.jpg)
43+
44+
A third drawback of ESP-MESH, is that you can't easily connect to nodes in the mesh from another client connected to the access point.
45+
46+
## ESP-MESH-LITE
47+
48+
To solve some of these drawbacks, Espressif created ESP-MESH-LITE, which confusingly has a better feature-set than ESP-MESH. I suppose the -LITE postfix is because it uses less resources?
49+
50+
ESP-MESH-LITE also uses the two interface solution, and they also have a tree topology. However, instead of only allowing certain types of payload over the mesh, every node has an active IP stack, and uses NAPT (basically NAT, Network Address Translation) to translate IP addresses on each node. This makes it so that nodes in the mesh can initiate arbitary TCP/IP connections to the outside; but you still can't easily initiate connections from outside the mesh to nodes in the mesh. What you can do, is set up NAT portforwarding rules on every node to forward incoming connections from outside of the mesh to the correct nodes below, but that is tedious, and you also need to choose beforehand which ports need to go to which hosts/port combination.
51+
52+
![Mesh bidirectional stream](/images/esp_mesh_lite_data_flow.jpg)
53+
54+
55+
However, recently, Espressif posted the following note in the ESP-MESH-LITE repository:
56+
57+
> Dear Developer Friends,
58+
> Thank you sincerely for your continued support and interest in the ESP-Mesh-Lite solution. In response to current technology development needs, we would like to make the following announcement:
59+
> Starting today, the ESP-Mesh-Lite open-source repository will enter Maintenance Mode, during which only essential security patches and critical bug fixes will be provided. Future technical iterations and commercial support will be transitioned to our private solution repository, designed specifically for enterprise users.
60+
> The private repository will offer:
61+
> - Access to tailored feature development to meet your specific project requirements
62+
> - Early access to pre-release technical updates for faster integration and validation
63+
> - Dedicated one-on-one technical support to ensure smooth development and timely issue resolution
64+
>
65+
> To ensure uninterrupted project continuity and access to technical support, we recommend contacting us via email at sales@espressif.com to join our private solution repository program.
66+
67+
## ESP-BLE-MESH
68+
69+
Espressif also provides Blueotooth meshing for the ESP32. This is not that interesting in this project, since as far as I can see, they don't really do TCP/IP over Bluetooth. The esp32-open-mac project itself is currently also only concerned with Wi-Fi, not Bluetooth.
70+
71+
# Why 802.11s is better
72+
73+
ESP-MESH and ESP-MESH-LITE are both Espressif-proprietary protocols: other devices likely won't be able to interoperate in their mesh networks without significant engineering work: some third-party devices might be able to associate with the SoftAP interface, but they likely won't be able to provide downstream connectivity for other nodes.
74+
75+
The Wi-Fi standard (IEEE 802.11) actually specifies a standard for mesh communication: 802.11s. This standard has several advantages over using ESP-MESH or ESP-MESH-LITE:
76+
77+
- It's specified in a standard, so other mesh devices can interoperate, as long as they follow the standard
78+
- It does its meshing on the MAC layer instead of on the IP-layer (ESP-MESH-LITE) or on the application layer (ESP-MESH). This makes the mesh basically transparent for other devices connected to the root access point: these other devices can directly connect to devices in the mesh and vice versa.
79+
- It does not force a tree topology: each node in the mesh can have multiple paths to the router. That way, the mesh network can cope better with nodes going down.
80+
81+
The proprietary Wi-Fi stack on the ESP32 unfortunately does not (yet) implement 802.11s standards-compliant meshing. Fortunately, we've reverse engineered enough of the Wi-Fi hardware on the ESP32 to be able to start implementing this ourselves. This will be the first feature in the 802.11 standard that is not implemented in the proprietary stack, but is implemented in the open source stack.
82+
83+
# Progress report on implementing 802.11s
84+
85+
We've started implementing 802.11s in [Ferris-on-Air](https://github.com/esp32-open-mac/foa). FoA is an experimental IEEE 802.11 stack, written in Rust, made for the ESP32. It already supported client mode and Apple AWDL. We now added a third interface mode: mesh mode. Note that the mesh networking support is not complete yet: we currently only support associating with a mesh network, but don't handle any data yet.
86+
87+
Implemented (see https://github.com/esp32-open-mac/FoA/pull/4):
88+
89+
- Sending / handling mesh beacon frames
90+
- Handling probe requests
91+
- Open mesh peering:
92+
- The finite state machine to open/confirm connections to other Mesh STAs
93+
- Timers required in the open/confirm FSM
94+
95+
Still to implement:
96+
97+
- Sending/routing data frames
98+
- Encryption of data frames
99+
- Authenticated mesh peering
100+
- Beacon timing adjustment
101+
102+
There is still a lot of work to be done before mesh networking fully works. I believe that most of this work can be done without additional hardware reverse engineering; so if you like writing no-std, embedded async Rust, like reading a 7000 page standard, and are up for a challenge, feel free [to join the effort](https://matrix.to/#/#esp32-open-mac:matrix.org).
103+
104+
105+
*All images used are from Espressifs documentation and licensed under Apache 2.0, see [here](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/esp-wifi-mesh.html) and [here](https://github.com/espressif/esp-mesh-lite/blob/release/v1.0/components/mesh_lite/User_Guide.md)*

hugo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title = "ESP32 open MAC"
33
theme = "coder"
44
languageCode = "en"
55
defaultContentLanguage = "en"
6-
paginate = 20
6+
pagination.pagerSize = 20
77
enableEmoji = true
88
# Enable Disqus comments
99
# disqusShortname = "yourdiscussshortname"
439 KB
Loading
47.5 KB
Loading
38.3 KB
Loading
29.1 KB
Loading
29.7 KB
Loading
29.5 KB
Loading
29.2 KB
Loading
41.9 KB
Loading

0 commit comments

Comments
 (0)