From 86fe60ad5a526f7f7fb609a124994402eca0fabe Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Mon, 6 Nov 2023 16:20:24 +0530 Subject: [PATCH] fix(wpa_supplicant): Add HT20_40 capability in assoc requests - Add the HT2040 capability indication in the extended caps IE of assoc requests. --- .../wpa_supplicant/esp_supplicant/src/esp_common.c | 9 ++++++++- components/wpa_supplicant/src/common/ieee802_11_defs.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_common.c b/components/wpa_supplicant/esp_supplicant/src/esp_common.c index 225fb702f0..e1e9ddb9e4 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_common.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_common.c @@ -21,6 +21,7 @@ #include "esp_rrm.h" #include "esp_wnm.h" #include "rsn_supp/wpa.h" +#include "esp_private/wifi.h" struct wpa_supplicant g_wpa_supp; @@ -550,6 +551,7 @@ 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}; if (!esp_wifi_is_btm_enabled_internal(WIFI_IF_STA)) { return 0; @@ -557,7 +559,12 @@ 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; + esp_err_t 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; diff --git a/components/wpa_supplicant/src/common/ieee802_11_defs.h b/components/wpa_supplicant/src/common/ieee802_11_defs.h index 2b4efcbb51..33eba1eb35 100644 --- a/components/wpa_supplicant/src/common/ieee802_11_defs.h +++ b/components/wpa_supplicant/src/common/ieee802_11_defs.h @@ -258,6 +258,7 @@ /* bits 0-3: Field length (n-1) */ #define WLAN_RSNX_CAPAB_SAE_H2E 5 +#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) */