Skip to content

Commit 7a329d5

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/delay_eap_start_v5.5' into 'release/v5.5'
fix(esp_wifi): Add some WFA issue fixes (v5.5) See merge request espressif/esp-idf!40360
2 parents ebaece4 + 97888e2 commit 7a329d5

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

components/wpa_supplicant/esp_supplicant/src/esp_eap_client.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static struct eap_sm *gEapSm = NULL;
6060

6161
static int eap_peer_sm_init(void);
6262
static void eap_peer_sm_deinit(void);
63+
static void eap_start_eapol(void *ctx, void *data);
6364

6465
static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid);
6566
static int wpa2_start_eapol_internal(void);
@@ -529,6 +530,10 @@ static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bss
529530
return ESP_FAIL;
530531
}
531532

533+
if (!sm->eap_process_started) {
534+
sm->eap_process_started = true;
535+
eloop_cancel_timeout(eap_start_eapol, NULL, NULL);
536+
}
532537
if (len < sizeof(*hdr) + sizeof(*ehdr)) {
533538
wpa_printf(MSG_DEBUG, "WPA: EAPOL frame too short to be a WPA "
534539
"EAPOL-Key (len %lu, expecting at least %lu)",
@@ -612,15 +617,28 @@ static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bss
612617
return ret;
613618
}
614619

615-
static int wpa2_start_eapol(void)
620+
static void eap_start_eapol(void *ctx, void *data)
616621
{
617622
#ifdef USE_WPA2_TASK
618-
return wpa2_post(SIG_WPA2_START, 0);
623+
wpa2_post(SIG_WPA2_START, 0);
619624
#else
620-
return wpa2_start_eapol_internal();
625+
wpa2_start_eapol_internal();
621626
#endif
622627
}
623628

629+
static int eap_start_eapol_timer(void)
630+
{
631+
/*
632+
* Do not send EAPOL-Start immediately since in most cases,
633+
* Authenticator is going to start authentication immediately
634+
* after association and an extra EAPOL-Start is just going to
635+
* delay authentication. Use a short timeout to send the first
636+
* EAPOL-Start if Authenticator does not start authentication.
637+
*/
638+
eloop_register_timeout(2, 0, eap_start_eapol, NULL, NULL);
639+
return 0;
640+
}
641+
624642
static int wpa2_start_eapol_internal(void)
625643
{
626644
struct eap_sm *sm = gEapSm;
@@ -739,6 +757,7 @@ static int eap_peer_sm_init(void)
739757
wpa_printf(MSG_INFO, "wifi_task prio:%d, stack:%d", WPA2_TASK_PRIORITY, WPA2_TASK_STACK_SIZE);
740758
#endif
741759
sm->workaround = 1;
760+
sm->eap_process_started = false;
742761
return ESP_OK;
743762

744763
_err:
@@ -806,7 +825,7 @@ static esp_err_t esp_client_enable_fn(void *arg)
806825
}
807826

808827
wpa2_cb->wpa2_sm_rx_eapol = wpa2_ent_rx_eapol;
809-
wpa2_cb->wpa2_start = wpa2_start_eapol;
828+
wpa2_cb->wpa2_start = eap_start_eapol_timer;
810829
wpa2_cb->wpa2_init = eap_peer_sm_init;
811830
wpa2_cb->wpa2_deinit = eap_peer_sm_deinit;
812831

components/wpa_supplicant/src/eap_peer/eap_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ struct eap_sm {
311311
size_t eapKeyDataLen;
312312
struct wpabuf *lastRespData;
313313
const struct eap_method *m;
314+
bool eap_process_started;
314315
};
315316

316317
typedef enum {

0 commit comments

Comments
 (0)