Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Added wifi_raw_80211_wifishark example, and added IEEE_80211 interface to esp-wifishark #1926

Closed

Conversation

leighleighleigh
Copy link

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

I wanted to view the raw 802.11 frames being received by the ESP32, so I have written a small proof-of-concept using the internal esp-wifi-sys API's. This can be found in the wifi_raw_80211_wifishark example.

I also added an additional packet-capture interface to extras/esp-wifishark, called wifi-rfmon, which correctly parses the serial data as IEEE 802.11 Link-Layer frames.

I don't really think it's a good idea to make examples out of unsafe API calls... but I know a few people were looking for this, and it's a very useful tool for wireless debugging when you don't have a monitor-mode-compatible interface at hand!

Note that this PR is dependent on #1925, for the queue_msg_waiting function.
As bjoernQ mentioned in #1603, I think it'd be a good idea to make anEsp80211 driver similar to the EspNow one. I will continue to look into this!

Testing

This example was tested on a XIAO ESP32S3, and the extras/esp-wifishark extcap plugin was compiled and used with Wireshark 4.2.6.

Personal To-do's

  • Formatting
  • Remove unneeded imports in the example

…ark to add an IEEE_802_11 DataLink interface
@Frostie314159
Copy link
Contributor

I would really like to collaborate on this. When I'm home, I'm gonna build an experimental abstraction, since the API is super simple.
I also made this Jeija/esp32-80211-tx#8 ,which we could also integrate into the abstraction. It is however not official and I'm not sure about the odds of it getting merged.

@leighleighleigh
Copy link
Author

That'd be sweet! FYI, my end goal is to implement a subset of batman-adv on top of this work. Do you think I'd need esp32-open-mac to pull that off? No worries if you are unfamiliar with it :)

@Frostie314159
Copy link
Contributor

I know some of the people, that worked on batman. @redfast00 started the project and his goal was to implement 802.11s as well. My goal is, once we've reversed the PHY sufficiently, to implement a wifi stack completely in rust. Using the injection API will be fine for now.

@redfast00
Copy link

I still need to test sending/receiving frames with 4 MAC addresses (as required for 802.11s); my original end-goal for esp32-open-mac was indeed implementing proper 802.11s mesh networking. I think to get good performance, you will need to implement MAC address filtering in hardware instead of using promiscuous mode and filtering in software. We can do HW filtering already in esp32-open-mac.

@Frostie314159
Copy link
Contributor

@leighleighleigh I just achieved the first raw transmission, with a very wonky setup, but it works.

@ProfFan
Copy link
Contributor

ProfFan commented Aug 12, 2024

batman-adv seems to be a great thing to have, especially given that ESP-NOW only allows very small packets.

Related #1879

@Frostie314159
Copy link
Contributor

Frostie314159 commented Aug 13, 2024

I've completed an experimental API on my private branch. I'll create a draft PR later today. Both sending and receiving are operational. #1935

@leighleighleigh
Copy link
Author

Thanks @Frostie314159 , it looks good - I'll update my wifishark example to test it out in the next couple days.

Easyoakland added a commit to Easyoakland/esp-hal that referenced this pull request Oct 6, 2024
adapted from esp-rs#1926

Co-authored-by: Leigh Oliver <leighcharlesoliver@gmail.com>
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.

4 participants