mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
fix(esp_wifi): Address some review comments
This commit is contained in:
Submodule components/esp_wifi/lib updated: f709d89ad9...ee87d8f94e
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -38,9 +38,8 @@ esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6])
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct wpa_supplicant g_wpa_supp;
|
struct wpa_supplicant g_wpa_supp;
|
||||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
|
||||||
static int mgmt_rx_action(u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 channel);
|
|
||||||
|
|
||||||
|
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
||||||
#if defined(CONFIG_RRM)
|
#if defined(CONFIG_RRM)
|
||||||
static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
|
static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
|
||||||
u8 *payload, size_t len, int8_t rssi)
|
u8 *payload, size_t len, int8_t rssi)
|
||||||
@ -339,8 +338,8 @@ void supplicant_sta_conn_handler(uint8_t *bssid)
|
|||||||
|
|
||||||
void supplicant_sta_disconn_handler(uint8_t reason_code)
|
void supplicant_sta_disconn_handler(uint8_t reason_code)
|
||||||
{
|
{
|
||||||
struct wpa_sm *sm = &gWpaSm;
|
|
||||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
||||||
|
struct wpa_sm *sm = &gWpaSm;
|
||||||
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
||||||
|
|
||||||
#if defined(CONFIG_RRM)
|
#if defined(CONFIG_RRM)
|
||||||
@ -357,7 +356,7 @@ void supplicant_sta_disconn_handler(uint8_t reason_code)
|
|||||||
wpa_s->current_bss = NULL;
|
wpa_s->current_bss = NULL;
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_IEEE80211R)
|
#if defined(CONFIG_IEEE80211R)
|
||||||
if (reason_code == WIFI_REASON_INVALID_PMKID || reason_code == WIFI_REASON_INVALID_MDE || reason_code == WIFI_REASON_INVALID_FTE || (sm->cur_pmksa == NULL)) {
|
if (!sm->cur_pmksa) {
|
||||||
/* clear all ft auth related IEs so that next will be open auth */
|
/* clear all ft auth related IEs so that next will be open auth */
|
||||||
wpa_sta_clear_ft_auth_ie();
|
wpa_sta_clear_ft_auth_ie();
|
||||||
}
|
}
|
||||||
@ -413,24 +412,23 @@ int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
|
|||||||
|
|
||||||
void neighbor_report_recvd_cb(void *ctx, const uint8_t *report, size_t report_len)
|
void neighbor_report_recvd_cb(void *ctx, const uint8_t *report, size_t report_len)
|
||||||
{
|
{
|
||||||
if (report == NULL) {
|
if (!report) {
|
||||||
wpa_printf(MSG_DEBUG, "RRM: Notifying neighbor report - NONE");
|
wpa_printf(MSG_DEBUG, "RRM: Notifying neighbor report - NONE");
|
||||||
esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, NULL, 0, 0);
|
esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, NULL, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "RRM: Notifying neighbor report (token = %d)", report[0]);
|
wpa_printf(MSG_DEBUG, "RRM: Notifying neighbor report (token = %d)", report[0]);
|
||||||
|
|
||||||
wifi_event_neighbor_report_t *neighbor_report_event = os_zalloc(sizeof(wifi_event_neighbor_report_t) + report_len);
|
wifi_event_neighbor_report_t *neighbor_report_event = os_zalloc(sizeof(wifi_event_neighbor_report_t) + report_len);
|
||||||
if (neighbor_report_event == NULL) {
|
if (!neighbor_report_event) {
|
||||||
wpa_printf(MSG_DEBUG, "memory alloc failed");
|
wpa_printf(MSG_DEBUG, "memory alloc failed");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report_len < ESP_WIFI_MAX_NEIGHBOR_REP_LEN) {
|
os_memcpy(neighbor_report_event->report, report, ESP_WIFI_MAX_NEIGHBOR_REP_LEN);
|
||||||
os_memcpy(neighbor_report_event->report, report, report_len);
|
|
||||||
}
|
|
||||||
os_memcpy(neighbor_report_event->n_report, report, report_len);
|
os_memcpy(neighbor_report_event->n_report, report, report_len);
|
||||||
neighbor_report_event->report_len = report_len;
|
neighbor_report_event->report_len = report_len;
|
||||||
esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, &neighbor_report_event, sizeof(wifi_event_neighbor_report_t), 0);
|
esp_event_post(WIFI_EVENT, WIFI_EVENT_STA_NEIGHBOR_REP, neighbor_report_event, sizeof(wifi_event_neighbor_report_t) + report_len, 0);
|
||||||
os_free(neighbor_report_event);
|
os_free(neighbor_report_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "common/wnm_sta.h"
|
#include "common/wnm_sta.h"
|
||||||
#include "esp_scan_i.h"
|
#include "esp_scan_i.h"
|
||||||
#include "esp_common_i.h"
|
#include "esp_common_i.h"
|
||||||
#include "eloop.h"
|
|
||||||
|
|
||||||
extern struct wpa_supplicant g_wpa_supp;
|
extern struct wpa_supplicant g_wpa_supp;
|
||||||
|
|
||||||
|
@ -295,6 +295,8 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code)
|
|||||||
case WIFI_REASON_ASSOC_FAIL:
|
case WIFI_REASON_ASSOC_FAIL:
|
||||||
case WIFI_REASON_CONNECTION_FAIL:
|
case WIFI_REASON_CONNECTION_FAIL:
|
||||||
case WIFI_REASON_HANDSHAKE_TIMEOUT:
|
case WIFI_REASON_HANDSHAKE_TIMEOUT:
|
||||||
|
case WIFI_REASON_INVALID_MDE:
|
||||||
|
case WIFI_REASON_INVALID_FTE:
|
||||||
wpa_sta_clear_curr_pmksa();
|
wpa_sta_clear_curr_pmksa();
|
||||||
wpa_sm_notify_disassoc(&gWpaSm);
|
wpa_sm_notify_disassoc(&gWpaSm);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user