mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
feat(wifi): Add support for transition_disable for softAP
Bugfix rsnxe len for assoc req
This commit is contained in:
parent
10b0d1fa1b
commit
484736976c
@ -508,20 +508,21 @@ typedef enum {
|
||||
* @brief Soft-AP configuration settings for the device
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t ssid[32]; /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
|
||||
uint8_t password[64]; /**< Password of soft-AP. */
|
||||
uint8_t ssid_len; /**< Optional length of SSID field. */
|
||||
uint8_t channel; /**< Channel of soft-AP */
|
||||
wifi_auth_mode_t authmode; /**< Auth mode of soft-AP. Do not support AUTH_WEP, AUTH_WAPI_PSK and AUTH_OWE in soft-AP mode. When the auth mode is set to WPA2_PSK, WPA2_WPA3_PSK or WPA3_PSK, the pairwise cipher will be overwritten with WIFI_CIPHER_TYPE_CCMP. */
|
||||
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
|
||||
uint8_t max_connection; /**< Max number of stations allowed to connect in */
|
||||
uint16_t beacon_interval; /**< Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100 */
|
||||
uint8_t csa_count; /**< Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Range: 1 ~ 30. Default value: 3 */
|
||||
uint8_t dtim_period; /**< Dtim period of soft-AP. Range: 1 ~ 10. Default value: 1 */
|
||||
wifi_cipher_type_t pairwise_cipher; /**< Pairwise cipher of SoftAP, group cipher will be derived using this. Cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP and WIFI_CIPHER_TYPE_TKIP_CCMP. */
|
||||
bool ftm_responder; /**< Enable FTM Responder mode */
|
||||
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */
|
||||
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
|
||||
uint8_t ssid[32]; /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
|
||||
uint8_t password[64]; /**< Password of soft-AP. */
|
||||
uint8_t ssid_len; /**< Optional length of SSID field. */
|
||||
uint8_t channel; /**< Channel of soft-AP */
|
||||
wifi_auth_mode_t authmode; /**< Auth mode of soft-AP. Do not support AUTH_WEP, AUTH_WAPI_PSK and AUTH_OWE in soft-AP mode. When the auth mode is set to WPA2_PSK, WPA2_WPA3_PSK or WPA3_PSK, the pairwise cipher will be overwritten with WIFI_CIPHER_TYPE_CCMP. */
|
||||
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
|
||||
uint8_t max_connection; /**< Max number of stations allowed to connect in */
|
||||
uint16_t beacon_interval; /**< Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100 */
|
||||
uint8_t csa_count; /**< Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Default value: 3 */
|
||||
uint8_t dtim_period; /**< Dtim period of soft-AP. Range: 1 ~ 10. Default value: 1 */
|
||||
wifi_cipher_type_t pairwise_cipher; /**< Pairwise cipher of SoftAP, group cipher will be derived using this. Cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP and WIFI_CIPHER_TYPE_TKIP_CCMP. */
|
||||
bool ftm_responder; /**< Enable FTM Responder mode */
|
||||
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */
|
||||
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
|
||||
uint8_t transition_disable; /**< Whether to enable transition disable feature */
|
||||
} wifi_ap_config_t;
|
||||
|
||||
#define SAE_H2E_IDENTIFIER_LEN 32 /**< Length of the password identifier for H2E */
|
||||
@ -560,7 +561,7 @@ typedef struct {
|
||||
uint32_t he_trig_mu_bmforming_partial_feedback_disabled: 1; /**< Whether to disable support the transmission of partial-bandwidth MU feedback in an HE TB sounding sequence. */
|
||||
uint32_t he_trig_cqi_feedback_disabled: 1; /**< Whether to disable support the transmission of CQI feedback in an HE TB sounding sequence. */
|
||||
uint32_t he_reserved: 22; /**< Reserved for future feature set */
|
||||
uint8_t sae_h2e_identifier[SAE_H2E_IDENTIFIER_LEN];/**< Password identifier for H2E. this needs to be null terminated string */
|
||||
uint8_t sae_h2e_identifier[SAE_H2E_IDENTIFIER_LEN]; /**< Password identifier for H2E. this needs to be null terminated string */
|
||||
} wifi_sta_config_t;
|
||||
|
||||
/**
|
||||
|
@ -161,6 +161,16 @@ void *hostap_init(void)
|
||||
os_memcpy(hapd->conf->ssid.wpa_passphrase, esp_wifi_ap_get_prof_password_internal(), strlen((char *)esp_wifi_ap_get_prof_password_internal()));
|
||||
hapd->conf->ssid.wpa_passphrase[WIFI_PASSWORD_LEN_MAX - 1] = '\0';
|
||||
hapd->conf->max_num_sta = esp_wifi_ap_get_max_sta_conn();
|
||||
auth_conf->transition_disable = esp_wifi_ap_get_transition_disable_internal();
|
||||
if (authmode != WIFI_AUTH_WPA3_PSK &&
|
||||
authmode != WIFI_AUTH_WPA2_WPA3_PSK && auth_conf->transition_disable) {
|
||||
auth_conf->transition_disable = 0;
|
||||
wpa_printf(MSG_DEBUG, "overriding transition_disable config with 0 as authmode is not WPA3");
|
||||
}
|
||||
|
||||
auth_conf->sae_require_mfp = 1;
|
||||
//TODO change it when AP support GCMP-PSK
|
||||
auth_conf->group_mgmt_cipher = WPA_CIPHER_AES_128_CMAC;
|
||||
|
||||
hapd->conf->ap_max_inactivity = 5 * 60;
|
||||
hostapd_setup_wpa_psk(hapd->conf);
|
||||
|
@ -128,7 +128,7 @@ struct wpa_funcs {
|
||||
bool (*wpa_sta_in_4way_handshake)(void);
|
||||
void *(*wpa_ap_init)(void);
|
||||
bool (*wpa_ap_deinit)(void *data);
|
||||
bool (*wpa_ap_join)(void **sm, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, u8* rsnxe, u8 rsnxe_len, bool *pmf_enable, int subtype, uint8_t *pairwise_cipher);
|
||||
bool (*wpa_ap_join)(void **sm, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, u8* rsnxe, u16 rsnxe_len, bool *pmf_enable, int subtype, uint8_t *pairwise_cipher);
|
||||
bool (*wpa_ap_remove)(u8 *bssid);
|
||||
uint8_t *(*wpa_ap_get_wpa_ie)(uint8_t *len);
|
||||
bool (*wpa_ap_rx_eapol)(void *hapd_data, void *sm, u8 *data, size_t data_len);
|
||||
@ -303,5 +303,6 @@ bool esp_wifi_eb_tx_status_success_internal(void *eb);
|
||||
uint8_t* esp_wifi_sta_get_rsnxe(u8 *bssid);
|
||||
esp_err_t esp_wifi_sta_connect_internal(const uint8_t *bssid);
|
||||
void esp_wifi_enable_sae_pk_only_mode_internal(void);
|
||||
uint8_t esp_wifi_ap_get_transition_disable_internal(void);
|
||||
|
||||
#endif /* _ESP_WIFI_DRIVER_H_ */
|
||||
|
@ -352,7 +352,7 @@ static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_i
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, u8 *rsnxe, u8 rsnxe_len, bool *pmf_enable, int subtype, uint8_t *pairwise_cipher)
|
||||
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, u8 *rsnxe, u16 rsnxe_len, bool *pmf_enable, int subtype, uint8_t *pairwise_cipher)
|
||||
{
|
||||
struct sta_info *sta_info = NULL;
|
||||
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
||||
|
@ -383,7 +383,7 @@ const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
|
||||
int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
|
||||
struct sta_info;
|
||||
bool hostap_new_assoc_sta(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie,
|
||||
uint8_t wpa_ie_len,uint8_t *rsnxe, uint8_t rsnxe_len,
|
||||
uint8_t wpa_ie_len, uint8_t *rsnxe, uint16_t rsnxe_len,
|
||||
bool *pmf_enable, int subtype, uint8_t *pairwise_cipher, uint8_t *reason);
|
||||
bool wpa_ap_remove(u8* bssid);
|
||||
|
||||
|
@ -1875,6 +1875,10 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING)
|
||||
}
|
||||
|
||||
kde_len = wpa_ie_len + ieee80211w_kde_len(sm);
|
||||
|
||||
if (sm->wpa_auth->conf.transition_disable)
|
||||
kde_len += 2 + RSN_SELECTOR_LEN + 1;
|
||||
|
||||
if (gtk)
|
||||
kde_len += 2 + RSN_SELECTOR_LEN + 2 + gtk_len;
|
||||
#ifdef CONFIG_IEEE80211R_AP
|
||||
@ -1911,6 +1915,9 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING)
|
||||
}
|
||||
pos = ieee80211w_kde_add(sm, pos);
|
||||
|
||||
if (sm->wpa_auth->conf.transition_disable)
|
||||
pos = wpa_add_kde(pos, WFA_KEY_DATA_TRANSITION_DISABLE,
|
||||
&sm->wpa_auth->conf.transition_disable, 1, NULL, 0);
|
||||
#ifdef CONFIG_IEEE80211R_AP
|
||||
if (wpa_key_mgmt_ft(sm->wpa_key_mgmt)) {
|
||||
int res;
|
||||
|
@ -144,6 +144,10 @@ struct wpa_auth_config {
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
enum mfp_options ieee80211w;
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
int group_mgmt_cipher;
|
||||
#ifdef CONFIG_SAE
|
||||
int sae_require_mfp;
|
||||
#endif /* CONFIG_SAE */
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
#define SSID_LEN 32
|
||||
u8 ssid[SSID_LEN];
|
||||
@ -163,6 +167,7 @@ struct wpa_auth_config {
|
||||
int ap_mlme;
|
||||
enum sae_pwe sae_pwe;
|
||||
struct rsn_sppamsdu_sup spp_sup;
|
||||
u8 transition_disable;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -388,6 +388,7 @@ u8 * wpa_add_kde(u8 *pos, u32 kde, const u8 *data, size_t data_len,
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
enum wpa_validate_result
|
||||
wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
|
||||
struct wpa_state_machine *sm,
|
||||
@ -563,8 +564,9 @@ wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
|
||||
return WPA_MGMT_FRAME_PROTECTION_VIOLATION;
|
||||
}
|
||||
|
||||
if (data.mgmt_group_cipher != WPA_CIPHER_AES_128_CMAC) {
|
||||
wpa_printf( MSG_DEBUG, "Unsupported management group "
|
||||
if (data.mgmt_group_cipher != wpa_auth->conf.group_mgmt_cipher)
|
||||
{
|
||||
wpa_printf(MSG_DEBUG, "Unsupported management group "
|
||||
"cipher %d", data.mgmt_group_cipher);
|
||||
return WPA_INVALID_MGMT_GROUP_CIPHER;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user