Merge branch 'bugfix/roaming_app_condition_compilation' into 'master'

Bugfix/roaming app condition compilation

Closes IDFGH-16568 and WIFIBUG-1493

See merge request espressif/esp-idf!42434
This commit is contained in:
Kapil Gupta
2025-12-10 17:49:50 +05:30
4 changed files with 18 additions and 5 deletions
@@ -16,9 +16,11 @@ struct roam_config {
int8_t low_rssi_threshold;
uint8_t rssi_threshold_reduction_offset;
bool scan_monitor;
#if CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR
uint8_t scan_interval;
int8_t scan_rssi_threshold;
uint8_t scan_rssi_diff;
#endif
bool legacy_roam_enabled;
uint8_t btm_retry_cnt;
bool btm_roaming_enabled;
@@ -73,7 +73,7 @@ menu "Roaming Methods"
config ESP_WIFI_ROAMING_NETWORK_ASSISTED_ROAM
bool "Support Network Assisted roaming using 802.11v"
depends on ESP_WIFI_WNM_SUPPORT
default n
default y
help
Roaming between APs using network assisted Roaming.
This involves BSS Transition Management mechanisms outlined in 802.11v.
@@ -154,7 +154,7 @@ config ESP_WIFI_ROAMING_BACKOFF_TIME
config ESP_WIFI_ROAMING_PERIODIC_RRM_MONITORING
bool "Send periodic neighbor report request to AP for internal list updation"
depends on ESP_WIFI_RRM_SUPPORT
default y
default n
help
This option will enable station to keep sending RRM neighbor list request to AP and
update its internal list.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -22,12 +22,18 @@ extern "C" {
#define ROAMING_BACKOFF_TIME CONFIG_ESP_WIFI_ROAMING_BACKOFF_TIME
/* Low RSSI based roaming configuration */
#ifndef CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING
#define CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING 0
#endif
#define LOW_RSSI_ROAMING_ENABLED CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING
#if LOW_RSSI_ROAMING_ENABLED
#define ROAMING_LOW_RSSI_THRESHOLD CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_THRESHOLD
#define RSSI_THRESHOLD_REDUCTION_OFFSET CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_OFFSET
#endif /*LOW_RSSI_ROAMING_ENABLED*/
#ifndef CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR
#define CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR 0
#endif
/* Periodic Scan based Roaming configuration */
#define PERIODIC_SCAN_MONITORING CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR
#if PERIODIC_SCAN_MONITORING
@@ -625,9 +625,8 @@ static void periodic_rrm_request(struct timeval *now)
static bool candidate_security_match(wifi_ap_record_t candidate)
{
u8 transition_disable = wpa_supplicant_get_transition_disable();
#if CONFIG_ESP_WIFI_ROAMING_PREVENT_DOWNGRADE
u8 transition_disable = wpa_supplicant_get_transition_disable();
if (transition_disable & TRANSITION_DISABLE_WPA3_PERSONAL) {
if (candidate.authmode == WIFI_AUTH_WPA2_PSK) {
return false;
@@ -967,9 +966,11 @@ static esp_err_t init_config_params(void)
g_roaming_app.config.rssi_threshold_reduction_offset = RSSI_THRESHOLD_REDUCTION_OFFSET;
g_roaming_app.config.scan_monitor = PERIODIC_SCAN_MONITORING;
#if PERIODIC_SCAN_MONITORING
g_roaming_app.config.scan_interval = SCAN_MONITOR_INTERVAL;
g_roaming_app.config.scan_rssi_threshold = SCAN_MONITOR_RSSI_THRESHOLD;
g_roaming_app.config.scan_rssi_diff = SCAN_ROAM_RSSI_DIFF;
#endif /* PERIODIC_SCAN_MONITORING */
g_roaming_app.config.legacy_roam_enabled = LEGACY_ROAM_ENABLED;
g_roaming_app.config.btm_retry_cnt = BSS_TM_RETRY_COUNT;
@@ -985,9 +986,11 @@ static esp_err_t init_config_params(void)
g_roaming_app.config.backoff_time, g_roaming_app.config.low_rssi_roam_trigger,
g_roaming_app.config.low_rssi_threshold, g_roaming_app.config.rssi_threshold_reduction_offset);
#if PERIODIC_SCAN_MONITORING
ESP_LOGD(ROAMING_TAG, "scan_monitor=%d scan_interval=%d scan_rssi_threshold=%d scan_rssi_diff=%d",
g_roaming_app.config.scan_monitor, g_roaming_app.config.scan_interval,
g_roaming_app.config.scan_rssi_threshold, g_roaming_app.config.scan_rssi_diff);
#endif /* PERIODIC_SCAN_MONITORING */
ESP_LOGD(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d",
g_roaming_app.config.legacy_roam_enabled,
@@ -1178,9 +1181,11 @@ static int update_config_params(void *data)
g_roaming_app.config.backoff_time, g_roaming_app.config.low_rssi_roam_trigger,
g_roaming_app.config.low_rssi_threshold, g_roaming_app.config.rssi_threshold_reduction_offset);
#if PERIODIC_SCAN_MONITORING
ESP_LOGI(ROAMING_TAG, "scan_monitor=%d scan_interval=%d scan_rssi_threshold=%d scan_rssi_diff=%d",
g_roaming_app.config.scan_monitor, g_roaming_app.config.scan_interval,
g_roaming_app.config.scan_rssi_threshold, g_roaming_app.config.scan_rssi_diff);
#endif
ESP_LOGI(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d",
g_roaming_app.config.legacy_roam_enabled,