fix(esp_wifi): Fix issues with extended caps IE, scan and HT40 mode

-Merges the addition of extended caps IE for assoc req, probe resp
 and beacons in a single place. This ensures that there are no
 duplicate Extended Caps IE in the frame. Moves the capability
 indication for BTM and HT20/40 from supplicant to wifi libs.

-Fix issue with frequent disconections when scanning for only a single
 channel.

-Prints error message and returns ESP_ERR_NOT_SUPPORTED in case
 esp32c2 tries to set bandwidth to HT40.
This commit is contained in:
jgujarathi 2023-08-28 11:52:20 +05:30
parent 3717963618
commit 906685898d
4 changed files with 14 additions and 7 deletions

View File

@ -1934,7 +1934,7 @@ ieee80211_vnd_lora_ie_set = 0x400020bc;
ieee80211_add_wme_param = 0x400020c0;
ieee80211_add_dsparams = 0x400020c4;
ieee80211_add_csa = 0x400020c8;
ieee80211_add_extcap = 0x400020cc;
/*ieee80211_add_extcap = 0x400020cc;*/
ieee80211_regdomain_get_country = 0x400020d0;
ieee80211_add_countryie = 0x400020d4;
ieee80211_amsdu_adjust_head = 0x400020dc;

@ -1 +1 @@
Subproject commit c2b2ae53810965f75d6b866deb802b01d316cc1f
Subproject commit 512cbf1c6bea47a94d46d2e84cd4b7e1529ec198

View File

@ -22,6 +22,7 @@
#include "esp_wnm.h"
#include "rsn_supp/wpa_i.h"
#include "rsn_supp/wpa.h"
#include "esp_private/wifi.h"
/* Utility Functions */
esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6])
@ -652,6 +653,8 @@ static uint8_t get_extended_caps_ie(uint8_t *ie, size_t len)
uint8_t ext_caps_ie[5] = {0};
uint8_t ext_caps_ie_len = 3;
uint8_t *pos = ext_caps_ie;
wifi_ioctl_config_t cfg = {0};
esp_err_t err = 0;
if (!esp_wifi_is_btm_enabled_internal(WIFI_IF_STA)) {
return 0;
@ -659,8 +662,14 @@ static uint8_t get_extended_caps_ie(uint8_t *ie, size_t len)
*pos++ = WLAN_EID_EXT_CAPAB;
*pos++ = ext_caps_ie_len;
*pos++ = 0;
*pos++ = 0;
err = esp_wifi_internal_ioctl(WIFI_IOCTL_GET_STA_HT2040_COEX, &cfg);
if (err == ESP_OK && cfg.data.ht2040_coex.enable) {
*pos++ |= BIT(WLAN_EXT_CAPAB_20_40_COEX);
} else {
*pos++ = 0;
}
*pos ++ = 0;
#define CAPAB_BSS_TRANSITION BIT(3)
*pos |= CAPAB_BSS_TRANSITION;
#undef CAPAB_BSS_TRANSITION
@ -872,9 +881,6 @@ void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
}
pos = ie;
#ifdef CONFIG_IEEE80211KV
ie_len = get_extended_caps_ie(pos, len);
pos += ie_len;
len -= ie_len;
ie_len = get_rm_enabled_ie(pos, len);
pos += ie_len;
len -= ie_len;

View File

@ -261,6 +261,7 @@
#define WLAN_RSNX_CAPAB_SAE_H2E 5
#define WLAN_RSNX_CAPAB_SAE_PK 6
#define WLAN_EXT_CAPAB_20_40_COEX 0
#define WLAN_EXT_CAPAB_BSS_TRANSITION 19
/* Action frame categories (IEEE Std 802.11-2016, 9.4.1.11, Table 9-76) */