blog icon indicating copy to clipboard operation
blog copied to clipboard

WiFi sniffer: change channel

Open Quatrus opened this issue 4 years ago • 1 comments

Hi, While testing the example from esp-idf/examples/wifi/simple_sniffer I found that esp_wifi_set_channel(...) did not work. One of the reasons was a missing call to esp_wifi_start(); One could see the following warning and the channel would not be changed!

W (592) wifi: STA is scanning or connecting, or AP has connected with external STAs, cannot set channel

This is fixed in your code but seems there is a second problem to get the capturing all the packets working.

Working on the same ESP-IDF example I had to use ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); to capture not only the broadcast messages but also ARP, DNS, DHCP, TCP, HTTP frames.

Quatrus avatar May 06 '20 16:05 Quatrus

Working on the same ESP-IDF example I had to use ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); to capture not only the broadcast messages but also ARP, DNS, DHCP, TCP, HTTP frames.

Also be aware of the condition on line 107 that will effectively skip all non management packets https://github.com/lpodkalicki/blog/blob/529cb9d04a549e3da2532fdd3fa68810f6c1e412/esp32/016_wifi_sniffer/main/main.c#L107-L108

risinek avatar Oct 17 '20 22:10 risinek