From 4de12b3c0c3d203353c2e88971b84a3827557d28 Mon Sep 17 00:00:00 2001 From: "kapil.gupta" Date: Sun, 7 Jun 2020 11:25:50 +0530 Subject: [PATCH] esp_wifi: Remove auth_changed event and fix wpa2 authmode threshold --- components/esp32/include/esp_wifi_types.h | 1 + components/esp32/lib | 2 +- docs/en/api-guides/wifi.rst | 17 +++++++++++++---- .../station/main/station_example_main.c | 6 +++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h index c838c3eefa..0ca2065655 100644 --- a/components/esp32/include/esp_wifi_types.h +++ b/components/esp32/include/esp_wifi_types.h @@ -93,6 +93,7 @@ typedef enum { WIFI_REASON_ASSOC_FAIL = 203, WIFI_REASON_HANDSHAKE_TIMEOUT = 204, WIFI_REASON_CONNECTION_FAIL = 205, + WIFI_REASON_AUTH_CHANGED = 206, } wifi_err_reason_t; typedef enum { diff --git a/components/esp32/lib b/components/esp32/lib index 6cafe865bb..465023a439 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 6cafe865bb5d3a93f6f09a243066f889bbf24e4f +Subproject commit 465023a439de478857c863f10ffb418ce3db075d diff --git a/docs/en/api-guides/wifi.rst b/docs/en/api-guides/wifi.rst index 780e2371f7..5fecbb9bcc 100644 --- a/docs/en/api-guides/wifi.rst +++ b/docs/en/api-guides/wifi.rst @@ -189,10 +189,6 @@ Generally, if the application has a correct error-handling code, upon receiving Ideally, the application sockets and the network layer should not be affected, since the Wi-Fi connection only fails temporarily and recovers very quickly. In future IDF releases, we are going to provide a more robust solution for handling events that disrupt Wi-Fi connection, as ESP32's Wi-Fi functionality continuously improves. -SYSTEM_EVENT_STA_AUTHMODE_CHANGE -++++++++++++++++++++++++++++++++++++ -This event arises when the AP to which the station is connected changes its authentication mode, e.g., from no auth to WPA. Upon receiving this event, the event task will do nothing. Generally, the application event callback does not need to handle this either. - SYSTEM_EVENT_STA_GOT_IP ++++++++++++++++++++++++++++++++++++ SYSTEM_EVENT_AP_STA_GOT_IP6 @@ -982,6 +978,17 @@ The table below shows the reason-code defined in ESP32. The first column is the | | | | WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT. | | | | | | +---------------------------+-------+---------+-------------------------------------------------------------+ +| CONNECTION_FAIL | 205 |reserved | Espressif-specific Wi-Fi reason-code: the | +| | | | connection to the AP has failed. | +| | | | | ++---------------------------+-------+---------+-------------------------------------------------------------+ +| AUTH_CHANGED | 206 |reserved | Espressif-specific Wi-Fi reason-code: the | +| | | | disconnection has happened since AP has changed the | +| | | | authmode. | +| | | | | ++---------------------------+-------+---------+-------------------------------------------------------------+ + + ESP32 Wi-Fi Configuration --------------------------- @@ -1160,6 +1167,8 @@ Home Channel In soft-AP mode, the home channel is defined as that of the soft-AP channel. In Station mode, the home channel is defined as the channel of the AP to which the station is connected. In Station+SoftAP mode, the home channel of soft-AP and station must be the same. If the home channels of Station and Soft-AP are different, the station's home channel is always in priority. Take the following as an example: at the beginning, the soft-AP is on channel 6, then the station connects to an AP whose channel is 9. Since the station's home channel has a higher priority, the soft-AP needs to switch its channel from 6 to 9 to make sure that both station and soft-AP have the same home channel. +.. attention:: + WEP/WPA security modes are deprecated in IEEE802.11-2016 specifications and are recommended not to be used. These modes c an be rejected using authmode threshold by setting threshold as WPA2 by threshold.authmode as WIFI_AUTH_WPA2_PSK. Wi-Fi Vendor IE Configuration +++++++++++++++++++++++++++++++++++ diff --git a/examples/wifi/getting_started/station/main/station_example_main.c b/examples/wifi/getting_started/station/main/station_example_main.c index 71e5297324..a8a7e7d4a1 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -80,7 +80,11 @@ void wifi_init_sta() wifi_config_t wifi_config = { .sta = { .ssid = EXAMPLE_ESP_WIFI_SSID, - .password = EXAMPLE_ESP_WIFI_PASS + .password = EXAMPLE_ESP_WIFI_PASS, + /* Setting a password implies station will connect to all security modes including WEP/WPA. + * However these modes are deprecated and not advisable to be used. Incase your Access point + * doesn't support WPA2, these mode can be enabled by commenting below line */ + .threshold.authmode = WIFI_AUTH_WPA2_PSK, }, };