mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
feat(wifi): Add support for transition_disable for softAP
Bugfix rsnxe len for assoc req
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user