ESP-WIFI: Optimize 4way handshake failure time

In case of wrong passpharse, AP will keep on sending 1/4 multiple
times which may take around 10 secs to disconnect and detect
wrong password event.

Add changes to reject EAPOL1 after 3 consecutive reception
This commit is contained in:
kapil.gupta
2020-05-19 16:20:04 +05:30
parent d6a6ac4d2d
commit fb53a454b9
4 changed files with 13 additions and 1 deletions

View File

@@ -48,6 +48,7 @@
#define WPA_TX_MSG_BUFF_MAXLEN 200
#define ASSOC_IE_LEN 24 + 2 + PMKID_LEN + RSN_SELECTOR_LEN
#define MAX_EAPOL_RETRIES 3
u8 assoc_ie_buf[ASSOC_IE_LEN+2];
void set_assoc_ie(u8 * assoc_buf);
@@ -1938,6 +1939,14 @@ int wpa_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len)
wpa_supplicant_process_3_of_4(sm, key, ver);
} else {
/* 1/4 4-Way Handshake */
sm->eapol1_count++;
if (sm->eapol1_count > MAX_EAPOL_RETRIES) {
#ifdef DEBUG_PRINT
wpa_printf(MSG_INFO, "EAPOL1 received for %d times, sending deauth", sm->eapol1_count);
#endif
esp_wifi_internal_issue_disconnect(WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT);
goto out;
}
wpa_supplicant_process_1_of_4(sm, src_addr, key,
ver);
}
@@ -2123,6 +2132,7 @@ int wpa_set_bss(char *macddr, char * bssid, u8 pairwise_cipher, u8 group_cipher,
wpa_sm_set_pmk_from_pmksa(sm);
}
sm->eapol1_count = 0;
#ifdef CONFIG_IEEE80211W
if (esp_wifi_sta_pmf_enabled()) {
wifi_config_t wifi_cfg;