Merge branch 'feature/softap_detect_wrong_password_attempt_v5.2' into 'release/v5.2'

esp_wifi: softAP: detect external station attempting to connect with wrong password  (Backport v5.2)

See merge request espressif/esp-idf!36455
This commit is contained in:
Jiang Jiang Jian
2025-01-17 10:36:42 +08:00
4 changed files with 15 additions and 1 deletions

View File

@@ -925,6 +925,7 @@ typedef enum {
WIFI_EVENT_NDP_TERMINATED, /**< NAN Datapath terminated indication */
WIFI_EVENT_HOME_CHANNEL_CHANGE, /**< WiFi home channel changedoesn'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
*

View File

@@ -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;

View File

@@ -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;
}