mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/minor_enterprise_fixes_v5.1' into 'release/v5.1'
Drop Eapol msg if EAP success is not processed (Backport v5.1) See merge request espressif/esp-idf!25065
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -36,6 +36,7 @@
|
|||||||
#include "esp_crt_bundle.h"
|
#include "esp_crt_bundle.h"
|
||||||
#endif
|
#endif
|
||||||
#include "esp_wpas_glue.h"
|
#include "esp_wpas_glue.h"
|
||||||
|
#include "esp_wpa2_i.h"
|
||||||
|
|
||||||
#define WPA2_VERSION "v2.0"
|
#define WPA2_VERSION "v2.0"
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ static int wpa2_start_eapol_internal(void);
|
|||||||
int wpa2_post(uint32_t sig, uint32_t par);
|
int wpa2_post(uint32_t sig, uint32_t par);
|
||||||
|
|
||||||
#ifdef USE_WPA2_TASK
|
#ifdef USE_WPA2_TASK
|
||||||
|
#define WPA2_TASK_PRIORITY 7
|
||||||
static void *s_wpa2_task_hdl = NULL;
|
static void *s_wpa2_task_hdl = NULL;
|
||||||
static void *s_wpa2_queue = NULL;
|
static void *s_wpa2_queue = NULL;
|
||||||
static wpa2_state_t s_wpa2_state = WPA2_STATE_DISABLED;
|
static wpa2_state_t s_wpa2_state = WPA2_STATE_DISABLED;
|
||||||
@ -115,6 +117,15 @@ static void wpa2_set_eap_state(wpa2_ent_eap_state_t state)
|
|||||||
esp_wifi_set_wpa2_ent_state_internal(state);
|
esp_wifi_set_wpa2_ent_state_internal(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wpa2_ent_eap_state_t wpa2_get_eap_state(void)
|
||||||
|
{
|
||||||
|
if (!gEapSm) {
|
||||||
|
return WPA2_ENT_EAP_STATE_NOT_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gEapSm->finish_state;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void wpa2_task_delete(void *arg)
|
static inline void wpa2_task_delete(void *arg)
|
||||||
{
|
{
|
||||||
void *my_task_hdl = os_task_get_current_task();
|
void *my_task_hdl = os_task_get_current_task();
|
||||||
@ -714,7 +725,7 @@ static int eap_peer_sm_init(void)
|
|||||||
gEapSm = sm;
|
gEapSm = sm;
|
||||||
#ifdef USE_WPA2_TASK
|
#ifdef USE_WPA2_TASK
|
||||||
s_wpa2_queue = os_queue_create(SIG_WPA2_MAX, sizeof(s_wpa2_queue));
|
s_wpa2_queue = os_queue_create(SIG_WPA2_MAX, sizeof(s_wpa2_queue));
|
||||||
ret = os_task_create(wpa2_task, "wpa2T", WPA2_TASK_STACK_SIZE, NULL, 2, &s_wpa2_task_hdl);
|
ret = os_task_create(wpa2_task, "wpa2T", WPA2_TASK_STACK_SIZE, NULL, WPA2_TASK_PRIORITY, &s_wpa2_task_hdl);
|
||||||
if (ret != TRUE) {
|
if (ret != TRUE) {
|
||||||
wpa_printf(MSG_ERROR, "wps enable: failed to create task");
|
wpa_printf(MSG_ERROR, "wps enable: failed to create task");
|
||||||
ret = ESP_FAIL;
|
ret = ESP_FAIL;
|
||||||
@ -727,7 +738,7 @@ static int eap_peer_sm_init(void)
|
|||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_printf(MSG_INFO, "wpa2_task prio:%d, stack:%d", 2, WPA2_TASK_STACK_SIZE);
|
wpa_printf(MSG_INFO, "wpa2_task prio:%d, stack:%d", WPA2_TASK_PRIORITY, WPA2_TASK_STACK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
|
14
components/wpa_supplicant/esp_supplicant/src/esp_wpa2_i.h
Normal file
14
components/wpa_supplicant/esp_supplicant/src/esp_wpa2_i.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ESP_WPA2_I_H
|
||||||
|
#define ESP_WPA2_I_H
|
||||||
|
|
||||||
|
#include "esp_wifi_driver.h"
|
||||||
|
|
||||||
|
wpa2_ent_eap_state_t wpa2_get_eap_state(void);
|
||||||
|
|
||||||
|
#endif
|
@ -35,6 +35,7 @@
|
|||||||
#include "esp_common_i.h"
|
#include "esp_common_i.h"
|
||||||
#include "esp_owe_i.h"
|
#include "esp_owe_i.h"
|
||||||
#include "common/sae.h"
|
#include "common/sae.h"
|
||||||
|
#include "esp_wpa2_i.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eapol_sm_notify_eap_success - Notification of external EAP success trigger
|
* eapol_sm_notify_eap_success - Notification of external EAP success trigger
|
||||||
@ -388,7 +389,6 @@ static void wpa_sm_pmksa_free_cb(struct rsn_pmksa_cache_entry *entry,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int wpa_supplicant_get_pmk(struct wpa_sm *sm,
|
static int wpa_supplicant_get_pmk(struct wpa_sm *sm,
|
||||||
const unsigned char *src_addr,
|
const unsigned char *src_addr,
|
||||||
const u8 *pmkid)
|
const u8 *pmkid)
|
||||||
@ -504,7 +504,7 @@ static int wpa_supplicant_get_pmk(struct wpa_sm *sm,
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
wpa_sm_ether_send(sm, sm->bssid, ETH_P_EAPOL,
|
wpa_sm_ether_send(sm, sm->bssid, ETH_P_EAPOL,
|
||||||
buf, buflen);
|
buf, buflen);
|
||||||
os_free(buf);
|
wpa_sm_free_eapol(buf);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,6 +653,14 @@ void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
|
|||||||
u8 *kde, *kde_buf = NULL;
|
u8 *kde, *kde_buf = NULL;
|
||||||
size_t kde_len;
|
size_t kde_len;
|
||||||
|
|
||||||
|
if (is_wpa2_enterprise_connection()) {
|
||||||
|
wpa2_ent_eap_state_t state = wpa2_get_eap_state();
|
||||||
|
if (state == WPA2_ENT_EAP_STATE_IN_PROGRESS) {
|
||||||
|
wpa_printf(MSG_INFO, "EAP Success has not been processed yet."
|
||||||
|
" Drop EAPOL message.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
wpa_sm_set_state(WPA_FIRST_HALF_4WAY_HANDSHAKE);
|
wpa_sm_set_state(WPA_FIRST_HALF_4WAY_HANDSHAKE);
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "WPA 1/4-Way Handshake");
|
wpa_printf(MSG_DEBUG, "WPA 1/4-Way Handshake");
|
||||||
|
Reference in New Issue
Block a user