AP: Add testing option to delay EAPOL Tx

Add a testing option to delay EAPOL-Key messages 1/4 and 3/4. By setting
delay_eapol_tx=1, the actual EAPOL Tx will occur on the last possible
attempt (wpa_pairwise_update_count) thus all previous attempts will fail
on timeout which is the wanted delay.

In addition, add an hwsim test that uses this testing option to verify
that non protected Robust Action frames are dropped prior to keys
installation in MFP.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Daniel Gabay 2022-12-01 18:54:35 +02:00 committed by Jouni Malinen
parent 1897abad94
commit bb67d5b52b
7 changed files with 70 additions and 1 deletions

View file

@ -1076,6 +1076,7 @@ struct hostapd_config {
double ignore_reassoc_probability;
double corrupt_gtk_rekey_mic_probability;
int ecsa_ie_only;
bool delay_eapol_tx;
#endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_ACS

View file

@ -1736,10 +1736,25 @@ static void wpa_send_eapol(struct wpa_authenticator *wpa_auth,
if (!sm)
return;
ctr = pairwise ? sm->TimeoutCtr : sm->GTimeoutCtr;
#ifdef CONFIG_TESTING_OPTIONS
/* When delay_eapol_tx is true, delay the EAPOL-Key transmission by
* sending it only on the last attempt after all timeouts for the prior
* skipped attemps. */
if (wpa_auth->conf.delay_eapol_tx &&
ctr != wpa_auth->conf.wpa_pairwise_update_count) {
wpa_msg(sm->wpa_auth->conf.msg_ctx, MSG_INFO,
"DELAY-EAPOL-TX-%d", ctr);
goto skip_tx;
}
#endif /* CONFIG_TESTING_OPTIONS */
__wpa_send_eapol(wpa_auth, sm, key_info, key_rsc, nonce, kde, kde_len,
keyidx, encr, 0);
#ifdef CONFIG_TESTING_OPTIONS
skip_tx:
#endif /* CONFIG_TESTING_OPTIONS */
ctr = pairwise ? sm->TimeoutCtr : sm->GTimeoutCtr;
if (ctr == 1 && wpa_auth->conf.tx_status)
timeout_ms = pairwise ? eapol_key_timeout_first :
eapol_key_timeout_first_group;

View file

@ -240,6 +240,7 @@ struct wpa_auth_config {
unsigned int gtk_rsc_override_set:1;
unsigned int igtk_rsc_override_set:1;
int ft_rsnxe_used;
bool delay_eapol_tx;
#endif /* CONFIG_TESTING_OPTIONS */
unsigned int oci_freq_override_eapol_m3;
unsigned int oci_freq_override_eapol_g1;

View file

@ -117,6 +117,7 @@ static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
#ifdef CONFIG_TESTING_OPTIONS
wconf->corrupt_gtk_rekey_mic_probability =
iconf->corrupt_gtk_rekey_mic_probability;
wconf->delay_eapol_tx = iconf->delay_eapol_tx;
if (conf->own_ie_override &&
wpabuf_len(conf->own_ie_override) <= MAX_OWN_IE_OVERRIDE) {
wconf->own_ie_override_len = wpabuf_len(conf->own_ie_override);