fix(wifi): Fixed compilation error when 11R is enabled without 11KV

Closes https://github.com/espressif/esp-idf/issues/15539
This commit is contained in:
Kapil Gupta
2025-03-17 23:16:04 +05:30
committed by Shreyas Sheth
parent 0defc6a651
commit 60883805f9

View File

@@ -85,32 +85,33 @@ static int mgmt_rx_action(u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 cha
return 0;
}
#if defined(CONFIG_WNM)
static void clear_bssid_flag_and_channel(struct wpa_supplicant *wpa_s)
{
#if defined(CONFIG_WNM)
wifi_config_t *config;
/* Reset only if btm is enabled */
if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA) == false)
return;
config = os_zalloc(sizeof(wifi_config_t));
if (!config) {
wpa_printf(MSG_ERROR, "failed to allocate memory");
if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA) == false) {
return;
}
esp_wifi_get_config(WIFI_IF_STA, config);
if (config->sta.bssid_set || config->sta.channel) {
config->sta.channel = 0;
config->sta.bssid_set = 0;
esp_wifi_set_config(WIFI_IF_STA, config);
}
os_free(config);
wpa_printf(MSG_DEBUG, "cleared bssid flag");
#endif /* CONFIG_WNM */
config = os_zalloc(sizeof(wifi_config_t));
if (!config) {
wpa_printf(MSG_ERROR, "failed to allocate memory");
return;
}
esp_wifi_get_config(WIFI_IF_STA, config);
if (config->sta.bssid_set || config->sta.channel) {
config->sta.channel = 0;
config->sta.bssid_set = 0;
esp_wifi_set_config(WIFI_IF_STA, config);
}
os_free(config);
wpa_printf(MSG_DEBUG, "cleared bssid flag");
}
#endif /* CONFIG_WNM */
#endif /* CONFIG_IEEE80211KV */
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
@@ -270,7 +271,7 @@ int esp_supplicant_common_init(struct wpa_funcs *wpa_cb)
int ret = 0;
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
#ifdef CONFIG_RRM
#if defined(CONFIG_RRM)
wpas_rrm_reset(wpa_s);
wpas_clear_beacon_rep_data(wpa_s);
#endif /* defined(CONFIG_RRM) */
@@ -312,8 +313,6 @@ void esp_supplicant_common_deinit(void)
wpa_s->type = 0;
esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype);
}
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
}
void supplicant_sta_conn_handler(uint8_t *bssid)
@@ -333,8 +332,10 @@ void supplicant_sta_conn_handler(uint8_t *bssid)
wpa_bss_flush(wpa_s);
/* Register for mgmt frames */
register_mgmt_frames(wpa_s);
#if defined(CONFIG_WNM)
/* clear set bssid flag */
clear_bssid_flag_and_channel(wpa_s);
#endif /* CONFIG_WNM */
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
}
@@ -346,13 +347,15 @@ void supplicant_sta_disconn_handler(uint8_t reason_code)
#if defined(CONFIG_RRM)
wpas_rrm_reset(wpa_s);
wpas_clear_beacon_rep_data(wpa_s);
#endif /* defined(CONFIG_RRM) */
#if defined(CONFIG_WNM)
/* Not clearing in case of roaming disconnect as BTM induced connection
* itself sets a specific bssid and channel to connect to before disconnection.
* Subsequent connections or disconnections will clear this flag */
if (reason_code != WIFI_REASON_ROAMING) {
clear_bssid_flag_and_channel(wpa_s);
}
#endif /* defined(CONFIG_RRM) */
#endif /* CONFIG_WNM */
if (wpa_s->current_bss) {
wpa_s->current_bss = NULL;
}