FT: Testing override for RSNXE Used subfield in FTE (AP)

Allow hostapd to be requested to override the RSNXE Used subfield in FT
reassociation case for testing purposes with "ft_rsnxe_used=<0/1/2>"
where 0 = no override, 1 = override to 1, and 2 = override to 0.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-04-16 23:22:57 +03:00 committed by Jouni Malinen
parent 7ad6016e19
commit a6c689d354
7 changed files with 26 additions and 0 deletions

View file

@ -4215,6 +4215,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
bss->no_beacon_rsnxe = atoi(pos); bss->no_beacon_rsnxe = atoi(pos);
} else if (os_strcmp(buf, "skip_prune_assoc") == 0) { } else if (os_strcmp(buf, "skip_prune_assoc") == 0) {
bss->skip_prune_assoc = atoi(pos); bss->skip_prune_assoc = atoi(pos);
} else if (os_strcmp(buf, "ft_rsnxe_used") == 0) {
bss->ft_rsnxe_used = atoi(pos);
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_SAE #ifdef CONFIG_SAE
} else if (os_strcmp(buf, "sae_password") == 0) { } else if (os_strcmp(buf, "sae_password") == 0) {

View file

@ -1477,6 +1477,12 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
if (hapd->started) if (hapd->started)
hostapd_setup_sae_pt(hapd->conf); hostapd_setup_sae_pt(hapd->conf);
} }
#ifdef CONFIG_TESTING_OPTIONS
if (os_strcmp(cmd, "ft_rsnxe_used") == 0)
wpa_auth_set_ft_rsnxe_used(hapd->wpa_auth,
hapd->conf->ft_rsnxe_used);
#endif /* CONFIG_TESTING_OPTIONS */
} }
return ret; return ret;

View file

@ -686,6 +686,7 @@ struct hostapd_bss_config {
struct wpabuf *igtk_rsc_override; struct wpabuf *igtk_rsc_override;
int no_beacon_rsnxe; int no_beacon_rsnxe;
int skip_prune_assoc; int skip_prune_assoc;
int ft_rsnxe_used;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#define MESH_ENABLED BIT(0) #define MESH_ENABLED BIT(0)

View file

@ -5459,4 +5459,11 @@ int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth)
return eloop_register_timeout(0, 0, wpa_rekey_gtk, wpa_auth, NULL); return eloop_register_timeout(0, 0, wpa_rekey_gtk, wpa_auth, NULL);
} }
void wpa_auth_set_ft_rsnxe_used(struct wpa_authenticator *wpa_auth, int val)
{
if (wpa_auth)
wpa_auth->conf.ft_rsnxe_used = val;
}
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */

View file

@ -238,6 +238,7 @@ struct wpa_auth_config {
unsigned int rsnxe_override_ft_set:1; unsigned int rsnxe_override_ft_set:1;
unsigned int gtk_rsc_override_set:1; unsigned int gtk_rsc_override_set:1;
unsigned int igtk_rsc_override_set:1; unsigned int igtk_rsc_override_set:1;
int ft_rsnxe_used;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
u8 ip_addr_go[4]; u8 ip_addr_go[4];
@ -522,5 +523,6 @@ int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
void *ctx1, void *ctx2); void *ctx1, void *ctx2);
int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth); int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth);
void wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm); void wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm);
void wpa_auth_set_ft_rsnxe_used(struct wpa_authenticator *wpa_auth, int val);
#endif /* WPA_AUTH_H */ #endif /* WPA_AUTH_H */

View file

@ -2647,6 +2647,13 @@ u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
} }
rsnxe_used = (auth_alg == WLAN_AUTH_FT) && rsnxe_used = (auth_alg == WLAN_AUTH_FT) &&
(conf->sae_pwe == 1 || conf->sae_pwe == 2); (conf->sae_pwe == 1 || conf->sae_pwe == 2);
#ifdef CONFIG_TESTING_OPTIONS
if (sm->wpa_auth->conf.ft_rsnxe_used) {
rsnxe_used = sm->wpa_auth->conf.ft_rsnxe_used == 1;
wpa_printf(MSG_DEBUG, "TESTING: FT: Force RSNXE Used %d",
rsnxe_used);
}
#endif /* CONFIG_TESTING_OPTIONS */
res = wpa_write_ftie(conf, use_sha384, r0kh_id, r0kh_id_len, res = wpa_write_ftie(conf, use_sha384, r0kh_id, r0kh_id_len,
anonce, snonce, pos, end - pos, anonce, snonce, pos, end - pos,
subelem, subelem_len, rsnxe_used); subelem, subelem_len, rsnxe_used);

View file

@ -174,6 +174,7 @@ static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
wpabuf_len(conf->igtk_rsc_override)); wpabuf_len(conf->igtk_rsc_override));
wconf->igtk_rsc_override_set = 1; wconf->igtk_rsc_override_set = 1;
} }
wconf->ft_rsnxe_used = conf->ft_rsnxe_used;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
os_memcpy(wconf->ip_addr_go, conf->ip_addr_go, 4); os_memcpy(wconf->ip_addr_go, conf->ip_addr_go, 4);