Merge branch 'bugfix/11kv_scan_event_removal_v4.4' into 'release/v4.4'

esp_wifi: Fixes related to 802.11kv (v4.4)

See merge request espressif/esp-idf!16034
This commit is contained in:
Jiang Jiang Jian
2021-11-23 07:15:31 +00:00
4 changed files with 30 additions and 16 deletions

View File

@ -22,8 +22,7 @@
extern struct wpa_supplicant g_wpa_supp;
static void scan_done_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
static void scan_done_event_handler(void *arg, STATUS status)
{
struct wpa_supplicant *wpa_s = &g_wpa_supp;
@ -90,8 +89,6 @@ void esp_scan_init(struct wpa_supplicant *wpa_s)
wpa_s->scanning = 0;
wpa_bss_init(wpa_s);
wpa_s->last_scan_res = NULL;
esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_SCAN_DONE,
&scan_done_event_handler, NULL);
}
void esp_scan_deinit(struct wpa_supplicant *wpa_s)
@ -99,8 +96,6 @@ 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,
&scan_done_event_handler);
}
int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
@ -223,8 +218,10 @@ static int issue_scan(struct wpa_supplicant *wpa_s,
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);
typedef void (* scan_done_cb_t)(void *arg, STATUS status);
extern int esp_wifi_promiscuous_scan_start(wifi_scan_config_t *config, scan_done_cb_t cb);
/* issue scan */
if (esp_wifi_scan_start(params, false) < 0) {
if (esp_wifi_promiscuous_scan_start(params, scan_done_event_handler) < 0) {
ret = -1;
goto cleanup;
}

View File

@ -38,6 +38,10 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
}
params = os_zalloc(sizeof(*params));
if (!params) {
wpa_printf(MSG_ERROR, "Memory allocation failed");
return;
}
if (wpa_s->wnm_mode) {
/* Use the same memory */
params->ssids[0].ssid = wpa_s->current_bss->ssid;

View File

@ -580,15 +580,15 @@ static void wnm_send_bss_transition_mgmt_resp(
struct wpabuf *buf;
int res;
wpa_printf(MSG_DEBUG,
"WNM: Send BSS Transition Management Response to " MACSTR
" dialog_token=%u status=%u reason=%u delay=%d",
MAC2STR(wpa_s->current_bss->bssid), dialog_token, status, reason, delay);
if (!wpa_s->current_bss) {
wpa_printf(MSG_DEBUG,
"WNM: Current BSS not known - drop response");
return;
}
wpa_printf(MSG_DEBUG,
"WNM: Send BSS Transition Management Response to " MACSTR
" dialog_token=%u status=%u reason=%u delay=%d",
MAC2STR(wpa_s->current_bss->bssid), dialog_token, status, reason, delay);
buf = wpabuf_alloc(BTM_RESP_MIN_SIZE);
if (!buf) {
@ -784,7 +784,7 @@ static void wnm_dump_cand_list(struct wpa_supplicant *wpa_s)
static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
{
unsigned int i;
int num_chan;
int num_chan = 0;
u8 chan = 0;
wpa_s->next_scan_chan = 0;
@ -802,8 +802,10 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
MAC2STR(nei->bssid));
return;
}
if (nei->channel_number != chan)
if (nei->channel_number != chan) {
chan = nei->channel_number;
num_chan++;
}
}
if (num_chan == 1) {
@ -826,6 +828,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_MBO
const u8 *vendor;
#endif /* CONFIG_MBO */
#ifdef ESP_SUPPLICANT
bool scan_required = false;
#endif
if (wpa_s->disable_mbo_oce || wpa_s->disable_btm)
return;
@ -904,9 +909,11 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
#ifdef ESP_SUPPLICANT
os_memset(wpa_s->next_scan_bssid, 0, ETH_ALEN);
wpa_s->next_scan_chan = 0;
#endif
scan_required = true;
#else
wpa_printf(MSG_DEBUG, "Trying to find another BSS");
wpa_supplicant_req_scan(wpa_s, 0, 0);
#endif
}
}
@ -1018,6 +1025,12 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
"WNM: Scan only for a specific BSSID since there is only a single candidate "
MACSTR, MAC2STR(wpa_s->next_scan_bssid));
}
#ifdef ESP_SUPPLICANT
scan_required = true;
}
if (scan_required) {
wpa_printf(MSG_DEBUG, "Trying to find another BSS");
#endif
wpa_supplicant_req_scan(wpa_s, 0, 0);
} else if (reply) {
enum bss_trans_mgmt_status_code status;
@ -1108,7 +1121,7 @@ void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
switch (act) {
case WNM_BSS_TRANS_MGMT_REQ:
ieee802_11_rx_bss_trans_mgmt_req(wpa_s, pos, end,
!(sender[0] & 0x01));
0x01);
break;
default:
wpa_printf(MSG_ERROR, "WNM: Unknown request");

View File

@ -1948,7 +1948,7 @@ int wpa_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len)
if (key_data_len > plen - keyhdrlen) {
#ifdef DEBUG_PRINT
wpa_printf(MSG_DEBUG, "WPA: Invalid EAPOL-Key "
"frame - key_data overflow (%d > %lu)",
"frame - key_data overflow (%u > %u)",
(unsigned int) key_data_len,
(unsigned int) (plen - keyhdrlen));
#endif