improved wifi sniffing (use all frames not only mgmt)

This commit is contained in:
Klaus K Wilting 2018-09-30 15:54:17 +02:00
parent 43b4946252
commit afc464d3f7

View File

@ -27,10 +27,11 @@ IRAM_ATTR void wifi_sniffer_packet_handler(void *buff,
void wifi_sniffer_init(void) {
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
cfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM
cfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM
cfg.wifi_task_core_id = 0; // we want wifi task running on core 0
wifi_promiscuous_filter_t filter = {
.filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // we need only MGMT frames
// .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames
.filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames
// esp_event_loop_init(NULL, NULL);
// ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
@ -56,9 +57,10 @@ void ChannelSwitchIRQ() {
}
// Wifi channel rotation task
void switchWifiChannel(void * parameter) {
void switchWifiChannel(void *parameter) {
while (1) {
// task is remaining in block state waiting for channel switch timer interrupt event
// task is remaining in block state waiting for channel switch timer
// interrupt event
xSemaphoreTake(xWifiChannelSwitchSemaphore, portMAX_DELAY);
// rotates variable channel 1..WIFI_CHANNEL_MAX
channel = (channel % WIFI_CHANNEL_MAX) + 1;