From b44da528db13ff7e19d073c8e5882c5283445b01 Mon Sep 17 00:00:00 2001 From: Shreyas Sheth Date: Mon, 25 Jul 2022 12:05:57 +0530 Subject: [PATCH] esp_wifi:Add wifi station config for enabling transition_disbale feature --- components/esp_wifi/include/esp_wifi_types.h | 3 ++- components/esp_wifi/lib | 2 +- components/wpa_supplicant/src/common/wpa_common.h | 4 ++++ .../wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c | 9 +++++++++ .../wpa_supplicant/src/esp_supplicant/esp_wpas_glue.h | 2 ++ components/wpa_supplicant/src/rsn_supp/wpa.c | 5 +++-- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index d281c06ab8..cb78d672a9 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -281,7 +281,8 @@ typedef struct { wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE. */ uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */ uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection */ - uint32_t reserved:30; /**< Reserved for future feature set */ + uint32_t transition_disable:1; /**< Whether to enable transition disable feature */ + uint32_t reserved:29; /**< Reserved for future feature set */ wifi_sae_pwe_method_t sae_pwe_h2e; /**< Whether SAE hash to element is enabled */ 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 incase best AP doesn't behave properly. */ } wifi_sta_config_t; diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index c5c29fcdaa..90d646774f 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit c5c29fcdaa057a2f1f504e8c6eee64d3923767f1 +Subproject commit 90d646774f5f1176564cc04cc1aeabeed407b82d diff --git a/components/wpa_supplicant/src/common/wpa_common.h b/components/wpa_supplicant/src/common/wpa_common.h index 4d67fe46a4..1b1b11c14f 100644 --- a/components/wpa_supplicant/src/common/wpa_common.h +++ b/components/wpa_supplicant/src/common/wpa_common.h @@ -296,6 +296,10 @@ struct rsn_rdie { #endif /* CONFIG_IEEE80211R */ +/* WFA Transition Disable KDE (using OUI_WFA) */ +/* Transition Disable Bitmap bits */ +#define TRANSITION_DISABLE_WPA3_PERSONAL BIT(0) + struct wpa_ie_data { int proto; int pairwise_cipher; diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c b/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c index 1e3fc424c7..1cf6686a69 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c @@ -61,6 +61,15 @@ void wpa_sm_free_eapol(u8 *buffer) os_free(buffer); } +void wpa_supplicant_transition_disable(void *sm, u8 bitmap) +{ + wpa_printf(MSG_INFO, "TRANSITION_DISABLE %02x", bitmap); + + if (bitmap & TRANSITION_DISABLE_WPA3_PERSONAL) { + esp_wifi_sta_disable_wpa2_authmode_internal(); + } +} + void wpa_sm_deauthenticate(struct wpa_sm *sm, u8 reason_code) { diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.h b/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.h index 4d867962e7..58b0b73d62 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.h +++ b/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.h @@ -28,6 +28,8 @@ void wpa_sm_disassociate(struct wpa_sm *sm, int reason_code); int wpa_sm_get_beacon_ie(struct wpa_sm *sm); +void wpa_supplicant_transition_disable(void *sm, u8 bitmap); + void wpa_sm_free_eapol(u8 *buffer); #endif /* WPAS_GLUE_H */ diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 9390128645..413a46dd5f 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -1355,8 +1355,9 @@ int ieee80211w_set_keys(struct wpa_sm *sm, goto failed; } - if (ie.transition_disable) - esp_wifi_sta_disable_wpa2_authmode_internal(); + if (ie.transition_disable) { + wpa_supplicant_transition_disable(sm, ie.transition_disable[0]); + } if (sm->key_install && sm->key_info & WPA_KEY_INFO_INSTALL && sm->use_ext_key_id) { wpa_supplicant_install_ptk(sm, KEY_FLAG_RX);