From 46486a863ce419297e9780646bc9fc8378f45402 Mon Sep 17 00:00:00 2001 From: "kapil.gupta" Date: Fri, 5 Jun 2020 13:08:52 +0530 Subject: [PATCH] esp_wifi: Remove auth_changed event and fix wpa2-ent authmode threshold Added following as part of this change 1. Removed auth_changed event 2. Updated doc regarding usage of WPA/WEP secuiry modes 3. Fixed WPA2 enterprise authmode threshold. --- components/esp_wifi/include/esp_wifi_types.h | 1 + components/esp_wifi/lib | 2 +- docs/en/api-guides/wifi.rst | 17 +++++++++++++---- .../station/main/station_example_main.c | 5 +++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index b71989cd4..0bfbccb8d 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/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/esp_wifi/lib b/components/esp_wifi/lib index 4db9824d5..d50eb2c81 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 4db9824d54b3df6e5bcdcac7bf306f6743f02aee +Subproject commit d50eb2c8187614ef0444fcf7db1a167e5996de94 diff --git a/docs/en/api-guides/wifi.rst b/docs/en/api-guides/wifi.rst index b4f755bac..d9918fe2f 100644 --- a/docs/en/api-guides/wifi.rst +++ b/docs/en/api-guides/wifi.rst @@ -182,10 +182,6 @@ Another thing deserves our attention is that the default behavior of LwIP is to In above scenario, ideally, the application sockets and the network layer should not be affected, since the Wi-Fi connection only fails temporarily and recovers very quickly. The application can enable "Keep TCP connections when IP changed" via LwIP menuconfig. -WIFI_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. - IP_EVENT_STA_GOT_IP ++++++++++++++++++++++++++++++++++++ This event arises when the DHCP client successfully gets the IPV4 address from the DHCP server, or when the IPV4 address is changed. The event means that everything is ready and the application can begin its tasks (e.g., creating sockets). @@ -1012,6 +1008,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 Station Connecting When Multiple APs Are Found --------------------------------------------------------------- @@ -1141,6 +1148,8 @@ API esp_wifi_set_config() can be used to configure the station. The table below | | threshold is open. | +------------------+--------------------------------------------------------------+ +.. attention:: + WEP/WPA security modes are deprecated in IEEE802.11-2016 specifications and are recommended not to be used. These modes can be rejected using authmode threshold by setting threshold as WPA2 by threshold.authmode as WIFI_AUTH_WPA2_PSK. AP Basic 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 8cbe60d58..b2c7cc6c6 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -82,6 +82,11 @@ void wifi_init_sta(void) .sta = { .ssid = EXAMPLE_ESP_WIFI_SSID, .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, + .pmf_cfg = { .capable = true, .required = false