diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index e7c9f4472c..72cc6c3401 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -925,6 +925,7 @@ typedef enum { WIFI_EVENT_NDP_TERMINATED, /**< NAN Datapath terminated indication */ WIFI_EVENT_HOME_CHANNEL_CHANGE, /**< WiFi home channel change,doesn't occur when scanning */ + WIFI_EVENT_AP_WRONG_PASSWORD, /**< a station tried to connect with wrong password */ WIFI_EVENT_MAX, /**< Invalid WiFi event ID */ } wifi_event_t; @@ -1025,6 +1026,11 @@ typedef struct { wifi_second_chan_t new_snd; /**< new second channel of the device */ } wifi_event_home_channel_change_t; +/** Argument structure for WIFI_EVENT_AP_WRONG_PASSWORD event */ +typedef struct { + uint8_t mac[6]; /**< MAC address of the station trying to connect to Soft-AP */ +} wifi_event_ap_wrong_password_t; + /** * @brief FTM operation status types * diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index b2f275a3cb..e316b1082c 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit b2f275a3cb179f989bbf8e9e2409cd1632ada8ad +Subproject commit e316b1082cbce7b07c6c61d42330889a38ac9dfa diff --git a/components/wpa_supplicant/src/ap/ieee802_11.c b/components/wpa_supplicant/src/ap/ieee802_11.c index 9fad4fd34d..a2f5365a46 100644 --- a/components/wpa_supplicant/src/ap/ieee802_11.c +++ b/components/wpa_supplicant/src/ap/ieee802_11.c @@ -624,6 +624,10 @@ int handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta, if (sae_check_confirm(sta->sae, buf, len) < 0) { resp = WLAN_STATUS_CHALLENGE_FAIL; + wifi_event_ap_wrong_password_t evt = {0}; + os_memcpy(evt.mac, bssid, ETH_ALEN); + esp_event_post(WIFI_EVENT, WIFI_EVENT_AP_WRONG_PASSWORD, &evt, + sizeof(evt), 0); goto reply; } sta->sae->rc = peer_send_confirm; diff --git a/components/wpa_supplicant/src/ap/wpa_auth.c b/components/wpa_supplicant/src/ap/wpa_auth.c index 58748a85ff..18a5069fb3 100644 --- a/components/wpa_supplicant/src/ap/wpa_auth.c +++ b/components/wpa_supplicant/src/ap/wpa_auth.c @@ -1668,6 +1668,10 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING) if (!ok) { wpa_printf(MSG_INFO, "invalid MIC in msg 2/4 of 4-Way Handshake"); + wifi_event_ap_wrong_password_t evt = {0}; + os_memcpy(evt.mac, sm->addr, ETH_ALEN); + esp_event_post(WIFI_EVENT, WIFI_EVENT_AP_WRONG_PASSWORD, &evt, + sizeof(evt), 0); return; }