mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 02:37:19 +02:00
fix(esp_wifi): Correctly break 11kv config into wnm and rrm configs
This commit is contained in:
committed by
Shreyas Sheth
parent
d8ca0675bb
commit
740e7607cd
@ -543,7 +543,7 @@ menu "Wi-Fi"
|
||||
config ESP_WIFI_RRM_SUPPORT
|
||||
bool "Enable 802.11k APIs Support"
|
||||
depends on ESP_WIFI_11KV_SUPPORT
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Select this option to enable 802.11k APIs(RRM support).
|
||||
Only APIs which are helpful for network assisted roaming
|
||||
@ -558,7 +558,7 @@ menu "Wi-Fi"
|
||||
config ESP_WIFI_WNM_SUPPORT
|
||||
bool "Enable 802.11v APIs Support"
|
||||
depends on ESP_WIFI_11KV_SUPPORT
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Select this option to enable 802.11v APIs(BTM support).
|
||||
Only APIs which are helpful for network assisted roaming
|
||||
|
@ -286,7 +286,7 @@ if(CONFIG_ESP_WIFI_DPP_SUPPORT)
|
||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_DPP)
|
||||
endif()
|
||||
if(CONFIG_ESP_WIFI_11KV_SUPPORT)
|
||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_WNM CONFIG_RRM CONFIG_IEEE80211KV)
|
||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_IEEE80211KV)
|
||||
endif()
|
||||
if(CONFIG_ESP_WIFI_RRM_SUPPORT)
|
||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_RRM)
|
||||
|
@ -36,8 +36,7 @@ esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6])
|
||||
|
||||
struct wpa_supplicant g_wpa_supp;
|
||||
|
||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
||||
#if defined(CONFIG_RRM)
|
||||
#ifdef CONFIG_RRM
|
||||
static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
|
||||
u8 *payload, size_t len, int8_t rssi)
|
||||
{
|
||||
@ -56,8 +55,10 @@ static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender,
|
||||
}
|
||||
#endif /* CONFIG_RRM */
|
||||
|
||||
#if defined(CONFIG_IEEE80211KV)
|
||||
static int mgmt_rx_action(u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 channel)
|
||||
{
|
||||
#if defined(CONFIG_RRM) || defined(CONFIG_WNM)
|
||||
u8 category;
|
||||
u8 bssid[ETH_ALEN];
|
||||
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
||||
@ -80,11 +81,13 @@ static int mgmt_rx_action(u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 cha
|
||||
handle_rrm_frame(wpa_s, sender, frame, len, rssi);
|
||||
}
|
||||
#endif /* CONFIG_RRM */
|
||||
#endif /* defined(CONFIG_RRM) || defined(CONFIG_WNM) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 */
|
||||
@ -99,14 +102,18 @@ static void clear_bssid_flag_and_channel(struct wpa_supplicant *wpa_s)
|
||||
}
|
||||
|
||||
esp_wifi_get_config(WIFI_IF_STA, config);
|
||||
if (config->sta.bssid_set) {
|
||||
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)
|
||||
static void register_mgmt_frames(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
wpa_s->type &= ~(1 << WLAN_FC_STYPE_ACTION);
|
||||
@ -137,6 +144,7 @@ static void register_mgmt_frames(struct wpa_supplicant *wpa_s)
|
||||
#endif /* CONFIG_IEEE80211R */
|
||||
esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype);
|
||||
}
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
static int handle_auth_frame(u8 *frame, size_t len,
|
||||
@ -182,7 +190,6 @@ static void wpa_sta_clear_ft_auth_ie(void)
|
||||
wpa_sm_drop_sa(sm);
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211R */
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
|
||||
void esp_supplicant_unset_all_appie(void)
|
||||
{
|
||||
@ -361,7 +368,6 @@ void supplicant_sta_disconn_handler(uint8_t reason_code)
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
||||
#if defined(CONFIG_RRM)
|
||||
bool esp_rrm_is_rrm_supported_connection(void)
|
||||
{
|
||||
@ -430,8 +436,8 @@ static size_t get_rm_enabled_ie(uint8_t *ie, size_t len)
|
||||
|
||||
return rrm_ie_len + 2;
|
||||
}
|
||||
|
||||
#endif /* defined(CONFIG_RRM) */
|
||||
|
||||
#if defined(CONFIG_WNM)
|
||||
bool esp_wnm_is_btm_supported_connection(void)
|
||||
{
|
||||
@ -585,9 +591,9 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
|
||||
esp_wifi_connect();
|
||||
}
|
||||
|
||||
#if defined(CONFIG_WNM) || defined(CONFIG_MBO)
|
||||
void esp_set_scan_ie(void)
|
||||
{
|
||||
#ifdef CONFIG_WNM
|
||||
#define SCAN_IE_LEN 64
|
||||
uint8_t *ie, *pos;
|
||||
size_t len = SCAN_IE_LEN, ie_len;
|
||||
@ -598,25 +604,29 @@ void esp_set_scan_ie(void)
|
||||
return;
|
||||
}
|
||||
pos = ie;
|
||||
#ifdef CONFIG_WNM
|
||||
ie_len = get_extended_caps_ie(pos, len);
|
||||
pos += ie_len;
|
||||
len -= ie_len;
|
||||
#endif /* defined(CONFIG_WNM) */
|
||||
#ifdef CONFIG_MBO
|
||||
ie_len = get_mbo_oce_scan_ie(pos, len);
|
||||
pos += ie_len;
|
||||
len -= ie_len;
|
||||
#endif /* CONFIG_MBO */
|
||||
esp_wifi_unset_appie_internal(WIFI_APPIE_PROBEREQ);
|
||||
esp_wifi_set_appie_internal(WIFI_APPIE_PROBEREQ, ie, SCAN_IE_LEN - len, 0);
|
||||
if (SCAN_IE_LEN - len) {
|
||||
esp_wifi_unset_appie_internal(WIFI_APPIE_PROBEREQ);
|
||||
esp_wifi_set_appie_internal(WIFI_APPIE_PROBEREQ, ie, SCAN_IE_LEN - len, 0);
|
||||
}
|
||||
os_free(ie);
|
||||
#undef SCAN_IE_LEN
|
||||
#endif /* defined(CONFIG_WNM) */
|
||||
}
|
||||
#endif /* defined(CONFIG_WNM) || defined(CONFIG_MBO) */
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
static size_t add_mdie(uint8_t *bssid, uint8_t *ie, size_t len)
|
||||
{
|
||||
size_t mdie_len = 0;
|
||||
size_t mdie_len = 0;
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
|
||||
/* Return if MBO IE is not enabled in driver */
|
||||
@ -714,15 +724,22 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
#ifndef CONFIG_WNM
|
||||
void esp_set_scan_ie(void) { }
|
||||
|
||||
bool esp_rrm_is_rrm_supported_connection(void)
|
||||
bool esp_wnm_is_btm_supported_connection(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason,
|
||||
const char *btm_candidates,
|
||||
int cand_list)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool esp_wnm_is_btm_supported_connection(void)
|
||||
#ifndef CONFIG_RRM
|
||||
bool esp_rrm_is_rrm_supported_connection(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -737,23 +754,15 @@ int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason,
|
||||
const char *btm_candidates,
|
||||
int cand_list)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
|
||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) || defined(CONFIG_WPA3_SAE)
|
||||
#if defined(CONFIG_RRM) || defined(CONFIG_IEEE80211R) || defined(CONFIG_WPA3_SAE)
|
||||
void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
|
||||
{
|
||||
#define ASSOC_IE_LEN 128
|
||||
uint8_t *ie, *pos;
|
||||
size_t len = ASSOC_IE_LEN;
|
||||
#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R)
|
||||
#if defined(CONFIG_RRM) || defined(CONFIG_IEEE80211R)
|
||||
size_t ie_len;
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */
|
||||
ie = os_malloc(ASSOC_IE_LEN + ies_len);
|
||||
@ -766,6 +775,7 @@ void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
|
||||
ie_len = get_rm_enabled_ie(pos, len);
|
||||
pos += ie_len;
|
||||
len -= ie_len;
|
||||
#endif /* defined(CONFIG_RRM) */
|
||||
#ifdef CONFIG_MBO
|
||||
ie_len = get_operating_class_ie(pos, len);
|
||||
pos += ie_len;
|
||||
@ -774,7 +784,6 @@ void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
|
||||
pos += ie_len;
|
||||
len -= ie_len;
|
||||
#endif /* CONFIG_MBO */
|
||||
#endif /* defined(CONFIG_RRM) */
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (mdie) {
|
||||
ie_len = add_mdie(bssid, pos, len);
|
||||
@ -793,4 +802,4 @@ void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
|
||||
}
|
||||
#else
|
||||
void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie) { }
|
||||
#endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) || defined(CONFIG_WPA3_SAE) */
|
||||
#endif /* defined(CONFIG_RRM) || defined(CONFIG_IEEE80211R) || defined(CONFIG_WPA3_SAE) */
|
||||
|
@ -2,3 +2,5 @@ CONFIG_ESP_WIFI_11KV_SUPPORT=y
|
||||
CONFIG_ESP_WIFI_SCAN_CACHE=y
|
||||
CONFIG_ESP_WIFI_MBO_SUPPORT=y
|
||||
CONFIG_ESP_WIFI_11R_SUPPORT=y
|
||||
CONFIG_ESP_WIFI_RRM_SUPPORT=y
|
||||
CONFIG_ESP_WIFI_WNM_SUPPORT=y
|
||||
|
Reference in New Issue
Block a user