Merge branch 'bugfix/parse_ftm_responder_v6.0' into 'release/v6.0'

bugfix(wifi): Ensure STA parses the FTM responder capability from the beacon correctly (Backport v6.0)

See merge request espressif/esp-idf!44713
This commit is contained in:
Jiang Jiang Jian
2026-01-08 13:47:30 +08:00
11 changed files with 42 additions and 29 deletions

View File

@@ -730,8 +730,8 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
/**
* @brief Set the bandwidth of specified interface
*
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.
* @attention 1. WIFI_BW40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW20.
* @attention 3. Can not set WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_bandwidths instead
* @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*
@@ -1092,6 +1092,9 @@ typedef void (*esp_vendor_ie_cb_t)(void *ctx, wifi_vendor_ie_type_t type, const
* @param vnd_ie Pointer to vendor specific element data. First 6 bytes should be a header with fields matching vendor_ie_data_t.
* If enable is false, this argument is ignored and can be NULL. Data does not need to remain valid after the function returns.
*
* @attention If user set the same vendor ie twice, the second set will fail and return ESP_ERR_INVALID_ARG.
* Please clear the vendor ie before setting again.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init()
@@ -1737,8 +1740,8 @@ esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protoco
/**
* @brief Set the bandwidth of specified interface and specified band
*
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.
* @attention 1. WIFI_BW40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW20.
* @attention 3. When the WiFi band mode is set to 2.4G only, it will not set 5G bandwidth
* @attention 4. When the WiFi band mode is set to 5G only, it will not set 2.4G bandwidth
*

View File

@@ -276,10 +276,8 @@ typedef enum {
* @brief Wi-Fi bandwidth type
*/
typedef enum {
WIFI_BW_HT20 = 1, /**< Bandwidth is HT20 */
WIFI_BW20 = WIFI_BW_HT20, /**< Bandwidth is 20 MHz */
WIFI_BW_HT40 = 2, /**< Bandwidth is HT40 */
WIFI_BW40 = WIFI_BW_HT40, /**< Bandwidth is 40 MHz */
WIFI_BW20 = 1, /**< Bandwidth is 20 MHz */
WIFI_BW40 = 2, /**< Bandwidth is 40 MHz */
WIFI_BW80 = 3, /**< Bandwidth is 80 MHz */
WIFI_BW160 = 4, /**< Bandwidth is 160 MHz */
WIFI_BW80_BW80 = 5, /**< Bandwidth is 80 + 80 MHz */
@@ -532,7 +530,7 @@ typedef struct {
wifi_cipher_type_t pairwise_cipher; /**< Pairwise cipher of SoftAP, group cipher will be derived using this. Cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP, WIFI_CIPHER_TYPE_TKIP_CCMP, WIFI_CIPHER_TYPE_GCMP and WIFI_CIPHER_TYPE_GCMP256. */
bool ftm_responder; /**< Enable FTM Responder mode */
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method. Default value :2 (WPA3_SAE_PWE_BOTH) */
uint8_t transition_disable: 1; /**< Whether to enable transition disable feature */
uint8_t sae_ext: 1; /**< Enable SAE EXT feature. SOC_GCMP_SUPPORT is required for this feature. */
uint8_t wpa3_compatible_mode: 1; /**< Enable WPA3 compatible authmode feature. Note: Enabling this will override the AP configuration's authmode and pairwise_cipher. The AP will operate as a WPA2 access point for all stations except for those that support WPA3 compatible mode. Only WPA3 compatibility mode stations will be able to use WPA3-SAE */
@@ -565,7 +563,7 @@ typedef struct {
uint32_t transition_disable: 1; /**< Whether to enable transition disable feature */
uint32_t disable_wpa3_compatible_mode: 1; /**< Whether to disable wpa3 compatible authmode feature. Disabling this prevents connecting to WPA3-Personal RSN override (compatibility mode) APs; connection falls back to WPA2 only. */
uint32_t reserved1: 25; /**< Reserved for future feature set */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method. Default value :2 (WPA3_SAE_PWE_BOTH) */
wifi_sae_pk_mode_t sae_pk_mode; /**< Configuration for SAE-PK (Public Key) Authentication method */
uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config.
Note: Enabling this may cause connection time to increase in case best AP doesn't behave properly. */

View File

@@ -723,7 +723,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set STA interface bandwidth to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c6
@@ -748,7 +748,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set bandwidth of station to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c5
@@ -777,8 +777,8 @@ Wi-Fi Bandwidth Mode
// Set bandwidth to 20 MHz for 2.4 GHz band and 40 MHz for 5 GHz band
wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20,
.ghz_5g = WIFI_BW_HT40
.ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW40
};
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -801,7 +801,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set bandwidth of the station interface to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. note::

View File

@@ -37,6 +37,8 @@ Removed Variables, Macros and Enum Values
- **FTM:** Field ``use_get_report_api`` from structure ``wifi_ftm_initiator_cfg_t`` and field ``ftm_report_data`` from structure ``wifi_event_ftm_report_t`` has been removed. Please use ``esp_wifi_ftm_get_report`` to fetch raw FTM report data instead.
- **Wi-Fi Bandwidth:** The enum values ``WIFI_BW_HT20`` and ``WIFI_BW_HT40`` have been removed. Please use the enum values ``WIFI_BW20`` and ``WIFI_BW40`` directly.
Modified Functions and Types
----------------------------

View File

@@ -723,7 +723,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c6
@@ -748,7 +748,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c5
@@ -777,8 +777,8 @@ Wi-Fi 带宽模式
// 设置 2.4 GHz 带宽为 20 MHz5 GHz 带宽为 40 MHz
wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20,
.ghz_5g = WIFI_BW_HT40
.ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW40
};
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -801,7 +801,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. note::

View File

@@ -37,6 +37,8 @@ Wi-Fi
- **FTM** 结构体 ``wifi_ftm_initiator_cfg_t`` 中的字段 ``use_get_report_api`` 和结构体 ``wifi_event_ftm_report_t`` 中的字段 ``ftm_report_data`` 已被移除。请改用 ``esp_wifi_ftm_get_report`` 获取原始 FTM 报告数据。
- **Wi-Fi 接口宏:** 枚举值 ``WIFI_BW_HT20````WIFI_BW_HT40`` 已被移除。请直接使用枚举值 ``WIFI_BW20````WIFI_BW40``
已修改的函数和类型
------------------

View File

@@ -437,10 +437,10 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
proto.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
proto.ghz_5g = 0;
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_2g = WIFI_BW_HT40;
bws.ghz_2g = WIFI_BW40;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} else {
bws.ghz_2g = WIFI_BW_HT20;
bws.ghz_2g = WIFI_BW20;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
}
} else {
@@ -449,13 +449,13 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11A;
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_5g=WIFI_BW_HT40;
bws.ghz_5g=WIFI_BW40;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} else {
proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11AC | WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11AX;
esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_5g = WIFI_BW_HT20;
bws.ghz_5g = WIFI_BW20;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
}
#endif

View File

@@ -4,7 +4,7 @@ dependencies:
espressif/iperf-cmd:
version: "~0.1.3"
esp-qa/wifi-cmd:
version: "~0.2.0"
version: "~0.2.7"
esp-qa/ping-cmd:
version: "~1.0.0"
espressif/esp_wifi_remote:

View File

@@ -277,8 +277,8 @@ static void wifi_itwt(void)
ESP_ERROR_CHECK(esp_wifi_sta_twt_config(&wifi_twt_config));
#if CONFIG_SOC_WIFI_SUPPORT_5G
wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20,
.ghz_5g = WIFI_BW_HT20,
.ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW20,
};
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -288,7 +288,7 @@ static void wifi_itwt(void)
};
esp_wifi_set_protocols(WIFI_IF_STA, &protocol);
#else
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20);
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW20);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX);
#endif
esp_wifi_set_ps(WIFI_PS_MIN_MODEM);

View File

@@ -753,3 +753,11 @@
-
re: "fatal error: soc/uart_channel.h: No such file or directory"
hint: "The header file 'soc/uart_channel.h' has been removed. All equivalent UART GPIO lookup macros can be found in 'soc/uart_pins.h' now."
-
re: "error: 'WIFI_BW_HT20' undeclared \\(first use in this function\\)"
hint: "The enum value 'WIFI_BW_HT20' has been removed. Use 'WIFI_BW20' instead."
-
re: "error: 'WIFI_BW_HT40' undeclared \\(first use in this function\\)"
hint: "The enum value 'WIFI_BW_HT40' has been removed. Use 'WIFI_BW40' instead."