Merge branch 'bugfix/set_default_authmode_wpa2' into 'master'

esp_wifi: set default authmode threshold as wpa2 for STA mode

Closes WIFI-2438

See merge request espressif/esp-idf!19034
This commit is contained in:
Jiang Jiang Jian
2022-08-02 11:10:56 +08:00
4 changed files with 13 additions and 8 deletions

View File

@@ -197,7 +197,8 @@ typedef enum {
/** @brief Structure describing parameters for a WiFi fast scan */ /** @brief Structure describing parameters for a WiFi fast scan */
typedef struct { typedef struct {
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */ int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */ wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode
Note: Incase this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */
}wifi_scan_threshold_t; }wifi_scan_threshold_t;
typedef enum { typedef enum {

View File

@@ -20,9 +20,11 @@ menu "Example Configuration"
choice ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD choice ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD
prompt "WiFi Scan auth mode threshold" prompt "WiFi Scan auth mode threshold"
default ESP_WIFI_AUTH_OPEN default ESP_WIFI_AUTH_WPA2_PSK
help help
The weakest authmode to accept in the scan mode. The weakest authmode to accept in the scan mode.
This value defaults to ESP_WIFI_AUTH_WPA2_PSK incase password is present and ESP_WIFI_AUTH_OPEN is used.
Please select ESP_WIFI_AUTH_WEP/ESP_WIFI_AUTH_WPA_PSK incase AP is operating in WEP/WPA mode.
config ESP_WIFI_AUTH_OPEN config ESP_WIFI_AUTH_OPEN
bool "OPEN" bool "OPEN"

View File

@@ -111,11 +111,13 @@ void wifi_init_sta(void)
.sta = { .sta = {
.ssid = EXAMPLE_ESP_WIFI_SSID, .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. /* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (pasword len => 8).
* However these modes are deprecated and not advisable to be used. Incase your Access point * If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value
* doesn't support WPA2, these mode can be enabled by commenting below line */ * to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD, * WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK standards.
.sae_pwe_h2e = WPA3_SAE_PWE_BOTH, */
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
.sae_pwe_h2e = WPA3_SAE_PWE_BOTH,
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );