diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld index d02528a7ca..343efdd6a6 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld @@ -23,7 +23,7 @@ pm_check_state = 0x40001b6c; pm_dream = 0x40001b78; pm_on_beacon_rx = 0x40001ba0; //pm_parse_beacon = 0x40001bac; -pm_process_tim = 0x40001bb0; +//pm_process_tim = 0x40001bb0; pm_rx_beacon_process = 0x40001bb4; pm_rx_data_process = 0x40001bb8; pm_sleep = 0x40001bbc; diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index 876e8c029c..0df4950951 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -949,7 +949,7 @@ ieee80211_getcapinfo = 0x40002130; /* sta_recv_sa_query_resp = 0x40002144; */ ieee80211_set_max_rate = 0x4000214c; ic_set_sta = 0x40002150; -ieee80211_parse_wpa = 0x40002158; +//ieee80211_parse_wpa = 0x40002158; ieee80211_add_assoc_req_ies = 0x40002160; ieee80211_add_probe_req_ies = 0x40002164; /* Data (.data, .bss, .rodata) */ diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld index 6de2e8c031..5dec621359 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld @@ -17,7 +17,7 @@ mac_tx_set_plcp1 = 0x40001640; pm_check_state = 0x40001648; /*pm_on_beacon_rx = 0x4000167c;*/ /*pm_parse_beacon = 0x40001688;*/ -pm_process_tim = 0x4000168c; +/*pm_process_tim = 0x4000168c;*/ pm_rx_beacon_process = 0x40001690; pm_rx_data_process = 0x40001694; /* pm_sleep = 0x40001698;*/ diff --git a/components/esp_rom/esp32c5/ld/esp32c5.rom.pp.ld b/components/esp_rom/esp32c5/ld/esp32c5.rom.pp.ld index e034f31e80..875ea947df 100644 --- a/components/esp_rom/esp32c5/ld/esp32c5.rom.pp.ld +++ b/components/esp_rom/esp32c5/ld/esp32c5.rom.pp.ld @@ -128,7 +128,7 @@ pm_on_isr_twt_wake = 0x40000d98; pm_on_tsf_timer = 0x40000d9c; pm_on_twt_force_tx = 0x40000da0; pm_parse_beacon = 0x40000da4; -pm_process_tim = 0x40000da8; +/*pm_process_tim = 0x40000da8;*/ pm_rx_beacon_process = 0x40000dac; pm_rx_data_process = 0x40000db0; pm_sleep = 0x40000db4; @@ -140,7 +140,7 @@ pm_extend_tbtt_adaptive_servo = 0x40000dc8; pm_scale_listen_interval = 0x40000dcc; pm_parse_mbssid_element = 0x40000dd0; pm_disconnected_wake = 0x40000dd4; -pm_tx_data_process = 0x40000dd8; +/*pm_tx_data_process = 0x40000dd8;*/ pm_is_twt_awake = 0x40000ddc; pm_enable_twt_keep_alive = 0x40000de0; pm_twt_on_tsf_timer = 0x40000de4; diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 8cf8d0de49..cabb434a39 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -539,6 +539,7 @@ typedef struct { uint8_t transition_disable; /**< Whether to enable transition disable feature */ uint8_t sae_ext; /**< Enable SAE EXT feature. SOC_GCMP_SUPPORT is required for this feature. */ wifi_bss_max_idle_config_t bss_max_idle_cfg; /**< Configuration for bss max idle, effective if CONFIG_WIFI_BSS_MAX_IDLE_SUPPORT is enabled */ + uint16_t gtk_rekey_interval; /**< GTK rekeying interval in seconds. If set to 0, GTK rekeying is disabled. Range: 60 ~ 65535 including 0. */ } wifi_ap_config_t; #define SAE_H2E_IDENTIFIER_LEN 32 /**< Length of the password identifier for H2E */ diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 0a6b4ae17b..c163646647 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 0a6b4ae17b00566fd45aae10696e2f728e63e245 +Subproject commit c1636466476b3ebbbbfbdb9122285008d5a7daf4 diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c b/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c index ccf7d81337..ab488f2155 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c @@ -84,6 +84,12 @@ void *hostap_init(void) hapd->conf->sae_pwe = esp_wifi_get_config_sae_pwe_h2e_internal(WIFI_IF_AP); auth_conf->sae_pwe = hapd->conf->sae_pwe; + auth_conf->wpa_group_rekey = esp_wifi_ap_get_gtk_rekeying_config_internal(); +#define MIN_GTK_REKEYING_INTERVAL 60 + if (auth_conf->wpa_group_rekey && auth_conf->wpa_group_rekey < MIN_GTK_REKEYING_INTERVAL) { + auth_conf->wpa_group_rekey = MIN_GTK_REKEYING_INTERVAL; + } +#undef MIN_GTK_REKEYING_INTERVAL authmode = esp_wifi_ap_get_prof_authmode_internal(); if (authmode_has_wpa(authmode)) { diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h b/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h index df068bba20..0419b884bd 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h @@ -285,6 +285,7 @@ esp_err_t esp_wifi_register_mgmt_frame_internal(uint32_t type, uint32_t subtype) esp_err_t esp_wifi_send_mgmt_frm_internal(const wifi_mgmt_frm_req_t *req); uint8_t esp_wifi_ap_get_prof_pairwise_cipher_internal(void); uint8_t esp_wifi_ap_get_sae_ext_config_internal(void); +uint16_t esp_wifi_ap_get_gtk_rekeying_config_internal(void); bool esp_wifi_is_mbo_enabled_internal(uint8_t if_index); void esp_wifi_get_pmf_config_internal(wifi_pmf_config_t *pmf_cfg, uint8_t ifx); bool esp_wifi_is_ft_enabled_internal(uint8_t if_index); diff --git a/components/wpa_supplicant/src/ap/wpa_auth.c b/components/wpa_supplicant/src/ap/wpa_auth.c index f5715611a8..a3c67cd136 100644 --- a/components/wpa_supplicant/src/ap/wpa_auth.c +++ b/components/wpa_supplicant/src/ap/wpa_auth.c @@ -211,6 +211,16 @@ int wpa_auth_for_each_sta(struct wpa_authenticator *wpa_auth, int (*cb)(struct wpa_state_machine *sm, void *ctx), void *cb_ctx) { + struct hostapd_data *hapd = hostapd_get_hapd_data(); + struct sta_info *sta; + + if (hapd == NULL) + return 1; + + for (sta = hapd->sta_list; sta; sta = sta->next) { + if (sta->wpa_sm && cb(sta->wpa_sm, cb_ctx)) + return 1; + } return 0; } @@ -397,6 +407,11 @@ struct wpa_authenticator * wpa_init(const u8 *addr, return NULL; } + if (wpa_auth->conf.wpa_group_rekey) { + eloop_register_timeout(wpa_auth->conf.wpa_group_rekey, + 0, wpa_rekey_gtk, wpa_auth, NULL); + } + #ifdef CONFIG_IEEE80211R_AP wpa_auth->ft_pmk_cache = wpa_ft_pmk_cache_init(); if (wpa_auth->ft_pmk_cache == NULL) { @@ -2565,6 +2580,7 @@ static int wpa_sm_step(struct wpa_state_machine *sm) void wpa_deinit(struct wpa_authenticator *wpa_auth) { struct wpa_group *group, *prev; + eloop_cancel_timeout(wpa_rekey_gtk, wpa_auth, NULL); pmksa_cache_auth_deinit(wpa_auth->pmksa); if (wpa_auth->wpa_ie != NULL) { os_free(wpa_auth->wpa_ie); diff --git a/examples/wifi/getting_started/softAP/main/Kconfig.projbuild b/examples/wifi/getting_started/softAP/main/Kconfig.projbuild index 19e9f86e01..5dcaa97c15 100644 --- a/examples/wifi/getting_started/softAP/main/Kconfig.projbuild +++ b/examples/wifi/getting_started/softAP/main/Kconfig.projbuild @@ -23,4 +23,18 @@ menu "Example Configuration" default 4 help Max number of the STA connects to AP. + + config ESP_GTK_REKEYING_ENABLE + bool "Enable GTK Rekeying" + default y + help + Flag to enable GTK rekeying. + + config ESP_GTK_REKEY_INTERVAL + int "GTK rekey interval" + depends on ESP_GTK_REKEYING_ENABLE + range 60 65535 + default 600 + help + GTK rekeying interval in seconds. endmenu diff --git a/examples/wifi/getting_started/softAP/main/softap_example_main.c b/examples/wifi/getting_started/softAP/main/softap_example_main.c index 941b0b77c3..c2bca87431 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -28,6 +28,12 @@ #define EXAMPLE_ESP_WIFI_CHANNEL CONFIG_ESP_WIFI_CHANNEL #define EXAMPLE_MAX_STA_CONN CONFIG_ESP_MAX_STA_CONN +#if CONFIG_ESP_GTK_REKEYING_ENABLE +#define EXAMPLE_GTK_REKEY_INTERVAL CONFIG_ESP_GTK_REKEY_INTERVAL +#else +#define EXAMPLE_GTK_REKEY_INTERVAL 0 +#endif + static const char *TAG = "wifi softAP"; static void wifi_event_handler(void* arg, esp_event_base_t event_base, @@ -81,6 +87,7 @@ void wifi_init_softap(void) .protected_keep_alive = 1, }, #endif + .gtk_rekey_interval = EXAMPLE_GTK_REKEY_INTERVAL, }, }; if (strlen(EXAMPLE_ESP_WIFI_PASS) == 0) {