Linux network interface for communication over the ESP-Now broadcast protocol.
Go to file
Morgan 'ARR\!' Allen a0e790ff76 partially parse radiotap header to get proper offset for contents 2024-01-06 13:08:19 -08:00
include use ssize_t in the now_receive callback flow 2024-01-06 13:05:24 -08:00
src partially parse radiotap header to get proper offset for contents 2024-01-06 13:08:19 -08:00
.gitignore IGNORE ME! 2024-01-05 13:16:11 -08:00
CMakeLists.txt still quite broken but a good starting point 2024-01-05 13:12:09 -08:00
README.md reference on radiotap 2024-01-06 12:59:48 -08:00

README.md

ifnow

A Linux network interface device for communication over the ESP-Now wireless broadcast protocol.

NOTE: This is EXTREMELY work in progress and as it requires root permissions is not recommended to be run unmonitored.

This code would not be possible without the groundwork done by the Linux-ESPNOW[github] project. They put in a huge amount of work to reverse engineer the ESP-Now protocol and provided some example code that this was heavily based on.

Additionally this article by John Millikin was an extremely helpful refresher on working with a Tun/Tap interface.

Build

git clone https://git.oit.cloud/morgan/ifnow.git
cd ifnow
mkdir build
cd build
cmake ../
make

This should result in the ifnow binary in the build directory.

Usage

This is two steps, first setting up monitoring mode (using aircrack-ng in this method). You will need to determine your wireless interface name and replace if different from wlp2s0 in the example. You will also want to set the channel to match the ESP32 configuration.

sudo airmon-ng start wlp2s0
sudo iw wlp2s0 set channel 1
./ifnow wlp2s0mon now1 10.10.0.13

The interface is now up as now1 and you should be able to write to this interface. In theory pcap can be used to intercept raw packets but if used with LwIP on the ESP32 end, which can be accomplished with esp_netif_now, any IP stack should work. Has been testing with UDP and some CoAP. There are definitely still issues with parsing some incoming packets.

Reference Material

These are resources I relied on during development to help me better understand the Linux network interface stack. Unfortunately there is not a lot of reference material on ESP-Now, Espressif only ships a binary blob and header file.

UDP/IP Stack

Radiotap