fix(esp_wifi): Check conditional compilation for roaming app features

This commit is contained in:
Kapil Gupta
2025-10-06 11:42:38 +05:30
committed by tarun.kumar
parent 4347dc6ff2
commit 9835845d98
4 changed files with 17 additions and 4 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;
@@ -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;
@@ -968,9 +967,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;
@@ -986,9 +987,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,
@@ -1179,9 +1182,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,
@@ -325,7 +325,7 @@ static void esp_neighbor_report_recv_handler(void* arg, esp_event_base_t event_b
g_neighbor_report_active = false;
uint8_t cand_list = 0;
wifi_event_neighbor_report_t *neighbor_report_event = (wifi_event_neighbor_report_t*)event_data;
uint8_t *pos = (uint8_t *)neighbor_report_event->report;
uint8_t *pos = (uint8_t *)neighbor_report_event->n_report;
char * neighbor_list = NULL;
if (!pos) {
ESP_LOGE(TAG, "Neighbor report is empty");