mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/rrm_caps_for_open_ap_v4.3' into 'release/v4.3'
wpa_supplicant: Fix some issues in 11kv (backport v4.3) See merge request espressif/esp-idf!13695
This commit is contained in:
commit
64dc45a2e6
@ -1 +1 @@
|
||||
Subproject commit a53d875951c4ff0c8632c2fef26e9578d46ecaf7
|
||||
Subproject commit 2f88f3fc9ee4cf34687aff96d2721b23d1ec5726
|
@ -123,6 +123,7 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
if (bss == wpa_s->current_bss)
|
||||
return 1;
|
||||
|
||||
#ifndef ESP_SUPPLICANT
|
||||
if (wpa_s->current_bss &&
|
||||
(bss->ssid_len != wpa_s->current_bss->ssid_len ||
|
||||
os_memcmp(bss->ssid, wpa_s->current_bss->ssid,
|
||||
@ -131,6 +132,8 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
|
||||
|
||||
return !is_zero_ether_addr(bss->bssid) && wpa_s->current_bss->bssid &&
|
||||
(os_memcmp(bss->bssid, wpa_s->current_bss->bssid, ETH_ALEN) == 0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wpa_bss_remove_oldest_unknown(struct wpa_supplicant *wpa_s)
|
||||
|
@ -754,6 +754,10 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
|
||||
if (wpa_s->wnm_dissoc_timer) {
|
||||
/* TODO: mark current BSS less preferred for
|
||||
* selection */
|
||||
#ifdef ESP_SUPPLICANT
|
||||
os_memset(wpa_s->next_scan_bssid, 0, ETH_ALEN);
|
||||
wpa_s->next_scan_chan = 0;
|
||||
#endif
|
||||
wpa_printf(MSG_DEBUG, "Trying to find another BSS");
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
|
@ -257,6 +257,22 @@ void esp_supplicant_common_init(struct wpa_funcs *wpa_cb)
|
||||
wpa_cb->wpa_sta_rx_mgmt = esp_ieee80211_handle_rx_frm;
|
||||
}
|
||||
|
||||
void esp_supplicant_common_deinit(void)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
||||
|
||||
if (esp_supplicant_post_evt(SIG_SUPPLICANT_DEL_TASK, 0) != 0) {
|
||||
wpa_printf(MSG_ERROR, "failed to send task delete event");
|
||||
}
|
||||
esp_scan_deinit(wpa_s);
|
||||
wpas_rrm_reset(wpa_s);
|
||||
wpas_clear_beacon_rep_data(wpa_s);
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED,
|
||||
&esp_supplicant_sta_conn_handler);
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED,
|
||||
&esp_supplicant_sta_disconn_handler);
|
||||
}
|
||||
|
||||
int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
|
||||
void *cb_ctx)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ int esp_ieee80211_handle_rx_frm(u8 type, u8 *frame, size_t len, u8 *sender,
|
||||
void esp_set_rm_enabled_ie(void);
|
||||
void esp_get_tx_power(uint8_t *tx_power);
|
||||
void esp_supplicant_common_init(struct wpa_funcs *wpa_cb);
|
||||
void esp_supplicant_common_deinit(void);
|
||||
#else
|
||||
|
||||
#include "esp_rrm.h"
|
||||
|
@ -36,16 +36,14 @@ static void esp_scan_done_event_handler(void* arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void* event_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
||||
if (!wpa_s->scanning) {
|
||||
/* update last scan time */
|
||||
wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA);
|
||||
wpa_printf(MSG_DEBUG, "scan not triggered by supplicant, ignore");
|
||||
return;
|
||||
}
|
||||
wpa_s->type &= ~(1 << WLAN_FC_STYPE_BEACON) & ~(1 << WLAN_FC_STYPE_PROBE_RESP);
|
||||
esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype);
|
||||
esp_supplicant_post_evt(SIG_SUPPLICANT_SCAN_DONE, 0);
|
||||
|
||||
/* update last scan time */
|
||||
wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA);
|
||||
if (!wpa_s->scanning) {
|
||||
wpa_s->type &= ~(1 << WLAN_FC_STYPE_BEACON) & ~(1 << WLAN_FC_STYPE_PROBE_RESP);
|
||||
esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype);
|
||||
}
|
||||
esp_supplicant_post_evt(SIG_SUPPLICANT_SCAN_DONE, 0);
|
||||
}
|
||||
|
||||
static void esp_supp_handle_wnm_scan_done(struct wpa_supplicant *wpa_s)
|
||||
@ -88,7 +86,9 @@ void esp_supplicant_handle_scan_done_evt(void)
|
||||
} else if (wpa_s->scan_reason == REASON_WNM_BSS_TRANS_REQ) {
|
||||
esp_supp_handle_wnm_scan_done(wpa_s);
|
||||
}
|
||||
esp_supp_scan_done_cleanup(wpa_s);
|
||||
if (wpa_s->scanning) {
|
||||
esp_supp_scan_done_cleanup(wpa_s);
|
||||
}
|
||||
wpa_bss_update_end(wpa_s);
|
||||
#ifndef SCAN_CACHE_SUPPORTED
|
||||
wpa_bss_flush(wpa_s);
|
||||
@ -107,6 +107,10 @@ void esp_scan_init(struct wpa_supplicant *wpa_s)
|
||||
void esp_scan_deinit(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
wpa_bss_deinit(wpa_s);
|
||||
os_free(wpa_s->last_scan_res);
|
||||
wpa_s->last_scan_res = NULL;
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_SCAN_DONE,
|
||||
&esp_scan_done_event_handler);
|
||||
}
|
||||
|
||||
int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
|
||||
|
@ -136,6 +136,7 @@ struct wpa_funcs {
|
||||
uint8_t *(*wpa3_build_sae_msg)(uint8_t *bssid, uint32_t type, size_t *len);
|
||||
int (*wpa3_parse_sae_msg)(uint8_t *buf, size_t len, uint32_t type, uint16_t status);
|
||||
int (*wpa_sta_rx_mgmt)(u8 type, u8 *frame, size_t len, u8 *sender, u32 rssi, u8 channel, u64 current_tsf);
|
||||
void (*wpa_config_done)(void);
|
||||
};
|
||||
|
||||
struct wpa2_funcs {
|
||||
|
@ -74,7 +74,7 @@ void wpa_deauthenticate(u8 reason_code)
|
||||
esp_wifi_deauthenticate_internal(reason_code);
|
||||
}
|
||||
|
||||
void wpa_config_profile(void)
|
||||
int wpa_config_profile(void)
|
||||
{
|
||||
if (esp_wifi_sta_prof_is_wpa_internal()) {
|
||||
wpa_set_profile(WPA_PROTO_WPA, esp_wifi_sta_get_prof_authmode_internal());
|
||||
@ -83,8 +83,10 @@ void wpa_config_profile(void)
|
||||
} else if (esp_wifi_sta_prof_is_wapi_internal()) {
|
||||
wpa_set_profile(WPA_PROTO_WAPI, esp_wifi_sta_get_prof_authmode_internal());
|
||||
} else {
|
||||
WPA_ASSERT(0);
|
||||
/* do nothing */
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wpa_config_bss(uint8_t *bssid)
|
||||
@ -106,7 +108,6 @@ void wpa_config_assoc_ie(u8 proto, u8 *assoc_buf, u32 assoc_wpa_ie_len)
|
||||
} else {
|
||||
esp_wifi_set_appie_internal(WIFI_APPIE_RSN, assoc_buf, assoc_wpa_ie_len, 1);
|
||||
}
|
||||
esp_set_rm_enabled_ie();
|
||||
}
|
||||
|
||||
void wpa_neg_complete(void)
|
||||
@ -172,11 +173,19 @@ bool wpa_deattach(void)
|
||||
|
||||
void wpa_sta_connect(uint8_t *bssid)
|
||||
{
|
||||
|
||||
/* use this API to set AP specific IEs during connection */
|
||||
int ret = 0;
|
||||
wpa_config_profile();
|
||||
ret = wpa_config_bss(bssid);
|
||||
WPA_ASSERT(ret == 0);
|
||||
ret = wpa_config_profile();
|
||||
if (ret == 0) {
|
||||
ret = wpa_config_bss(bssid);
|
||||
WPA_ASSERT(ret == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void wpa_config_done(void)
|
||||
{
|
||||
/* used in future for setting scan and assoc IEs */
|
||||
esp_set_rm_enabled_ie();
|
||||
}
|
||||
|
||||
int wpa_parse_wpa_ie_wrapper(const u8 *wpa_ie, size_t wpa_ie_len, wifi_wpa_ie_t *data)
|
||||
@ -222,6 +231,9 @@ static inline void esp_supplicant_common_init(struct wpa_funcs *wpa_cb)
|
||||
{
|
||||
wpa_cb->wpa_sta_rx_mgmt = NULL;
|
||||
}
|
||||
static inline void esp_supplicant_common_deinit(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int esp_supplicant_init(void)
|
||||
@ -253,6 +265,8 @@ int esp_supplicant_init(void)
|
||||
wpa_cb->wpa_parse_wpa_ie = wpa_parse_wpa_ie_wrapper;
|
||||
wpa_cb->wpa_config_bss = NULL;//wpa_config_bss;
|
||||
wpa_cb->wpa_michael_mic_failure = wpa_michael_mic_failure;
|
||||
wpa_cb->wpa_config_done = wpa_config_done;
|
||||
|
||||
esp_wifi_register_wpa3_cb(wpa_cb);
|
||||
esp_supplicant_common_init(wpa_cb);
|
||||
|
||||
@ -267,5 +281,6 @@ int esp_supplicant_init(void)
|
||||
|
||||
int esp_supplicant_deinit(void)
|
||||
{
|
||||
esp_supplicant_common_deinit();
|
||||
return esp_wifi_unregister_wpa_cb_internal();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user