OCV: OCI channel override support for testing (STA)

Add override parameters to use the specified channel while populating
OCI element in EAPOL-Key group msg 2/2, FT reassoc request, FILS assoc
request and WNM sleep request frames.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
This commit is contained in:
Veerendranath Jakkam 2020-06-26 13:49:14 +05:30 committed by Jouni Malinen
parent d309dd52b0
commit b28b9dfcbf
8 changed files with 78 additions and 0 deletions

View file

@ -2039,6 +2039,15 @@ static int wpa_supplicant_send_2_of_2(struct wpa_sm *sm,
os_free(rbuf); os_free(rbuf);
return -1; return -1;
} }
#ifdef CONFIG_TESTING_OPTIONS
if (sm->oci_freq_override_eapol_g2) {
wpa_printf(MSG_INFO,
"TEST: Override OCI KDE frequency %d -> %d MHz",
ci.frequency,
sm->oci_freq_override_eapol_g2);
ci.frequency = sm->oci_freq_override_eapol_g2;
}
#endif /* CONFIG_TESTING_OPTIONS */
pos = key_mic + mic_len + 2; /* Key Data */ pos = key_mic + mic_len + 2; /* Key Data */
if (ocv_insert_oci_kde(&ci, &pos) < 0) { if (ocv_insert_oci_kde(&ci, &pos) < 0) {
@ -3308,6 +3317,15 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
case WPA_PARAM_OCI_FREQ_EAPOL: case WPA_PARAM_OCI_FREQ_EAPOL:
sm->oci_freq_override_eapol = value; sm->oci_freq_override_eapol = value;
break; break;
case WPA_PARAM_OCI_FREQ_EAPOL_G2:
sm->oci_freq_override_eapol_g2 = value;
break;
case WPA_PARAM_OCI_FREQ_FT_ASSOC:
sm->oci_freq_override_ft_assoc = value;
break;
case WPA_PARAM_OCI_FREQ_FILS_ASSOC:
sm->oci_freq_override_fils_assoc = value;
break;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
case WPA_PARAM_DPP_PFS: case WPA_PARAM_DPP_PFS:
@ -4565,6 +4583,15 @@ struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
wpabuf_free(buf); wpabuf_free(buf);
return NULL; return NULL;
} }
#ifdef CONFIG_TESTING_OPTIONS
if (sm->oci_freq_override_fils_assoc) {
wpa_printf(MSG_INFO,
"TEST: Override OCI KDE frequency %d -> %d MHz",
ci.frequency,
sm->oci_freq_override_fils_assoc);
ci.frequency = sm->oci_freq_override_fils_assoc;
}
#endif /* CONFIG_TESTING_OPTIONS */
pos = wpabuf_put(buf, OCV_OCI_EXTENDED_LEN); pos = wpabuf_put(buf, OCV_OCI_EXTENDED_LEN);
if (ocv_insert_extended_oci(&ci, pos) < 0) { if (ocv_insert_extended_oci(&ci, pos) < 0) {

View file

@ -110,6 +110,9 @@ enum wpa_sm_conf_params {
WPA_PARAM_FT_RSNXE_USED, WPA_PARAM_FT_RSNXE_USED,
WPA_PARAM_DPP_PFS, WPA_PARAM_DPP_PFS,
WPA_PARAM_OCI_FREQ_EAPOL, WPA_PARAM_OCI_FREQ_EAPOL,
WPA_PARAM_OCI_FREQ_EAPOL_G2,
WPA_PARAM_OCI_FREQ_FT_ASSOC,
WPA_PARAM_OCI_FREQ_FILS_ASSOC,
}; };
struct rsn_supp_config { struct rsn_supp_config {

View file

@ -353,6 +353,14 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
os_free(buf); os_free(buf);
return NULL; return NULL;
} }
#ifdef CONFIG_TESTING_OPTIONS
if (sm->oci_freq_override_ft_assoc) {
wpa_printf(MSG_INFO,
"TEST: Override OCI KDE frequency %d -> %d MHz",
ci.frequency, sm->oci_freq_override_ft_assoc);
ci.frequency = sm->oci_freq_override_ft_assoc;
}
#endif /* CONFIG_TESTING_OPTIONS */
*pos++ = FTIE_SUBELEM_OCI; *pos++ = FTIE_SUBELEM_OCI;
*pos++ = OCV_OCI_LEN; *pos++ = OCV_OCI_LEN;

View file

@ -156,6 +156,9 @@ struct wpa_sm {
struct wpabuf *test_assoc_ie; struct wpabuf *test_assoc_ie;
int ft_rsnxe_used; int ft_rsnxe_used;
unsigned int oci_freq_override_eapol; unsigned int oci_freq_override_eapol;
unsigned int oci_freq_override_eapol_g2;
unsigned int oci_freq_override_ft_assoc;
unsigned int oci_freq_override_fils_assoc;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_FILS #ifdef CONFIG_FILS

View file

@ -757,6 +757,20 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
wpa_s->oci_freq_override_saquery_req = atoi(value); wpa_s->oci_freq_override_saquery_req = atoi(value);
} else if (os_strcasecmp(cmd, "oci_freq_override_saquery_resp") == 0) { } else if (os_strcasecmp(cmd, "oci_freq_override_saquery_resp") == 0) {
wpa_s->oci_freq_override_saquery_resp = atoi(value); wpa_s->oci_freq_override_saquery_resp = atoi(value);
} else if (os_strcasecmp(cmd, "oci_freq_override_eapol_g2") == 0) {
wpa_s->oci_freq_override_eapol_g2 = atoi(value);
/* Populate value to wpa_sm if already associated. */
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_EAPOL_G2,
wpa_s->oci_freq_override_eapol_g2);
} else if (os_strcasecmp(cmd, "oci_freq_override_ft_assoc") == 0) {
wpa_s->oci_freq_override_ft_assoc = atoi(value);
/* Populate value to wpa_sm if already associated. */
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_FT_ASSOC,
wpa_s->oci_freq_override_ft_assoc);
} else if (os_strcasecmp(cmd, "oci_freq_override_fils_assoc") == 0) {
wpa_s->oci_freq_override_fils_assoc = atoi(value);
} else if (os_strcasecmp(cmd, "oci_freq_override_wnm_sleep") == 0) {
wpa_s->oci_freq_override_wnm_sleep = atoi(value);
} else if (os_strcasecmp(cmd, "rsne_override_eapol") == 0) { } else if (os_strcasecmp(cmd, "rsne_override_eapol") == 0) {
wpabuf_free(wpa_s->rsne_override_eapol); wpabuf_free(wpa_s->rsne_override_eapol);
if (os_strcmp(value, "NULL") == 0) if (os_strcmp(value, "NULL") == 0)
@ -8438,6 +8452,10 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
wpa_s->oci_freq_override_eapol = 0; wpa_s->oci_freq_override_eapol = 0;
wpa_s->oci_freq_override_saquery_req = 0; wpa_s->oci_freq_override_saquery_req = 0;
wpa_s->oci_freq_override_saquery_resp = 0; wpa_s->oci_freq_override_saquery_resp = 0;
wpa_s->oci_freq_override_eapol_g2 = 0;
wpa_s->oci_freq_override_ft_assoc = 0;
wpa_s->oci_freq_override_fils_assoc = 0;
wpa_s->oci_freq_override_wnm_sleep = 0;
#ifdef CONFIG_DPP #ifdef CONFIG_DPP
os_free(wpa_s->dpp_config_obj_override); os_free(wpa_s->dpp_config_obj_override);
wpa_s->dpp_config_obj_override = NULL; wpa_s->dpp_config_obj_override = NULL;

View file

@ -121,6 +121,15 @@ int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
os_free(wnmtfs_ie); os_free(wnmtfs_ie);
return -1; return -1;
} }
#ifdef CONFIG_TESTING_OPTIONS
if (wpa_s->oci_freq_override_wnm_sleep) {
wpa_printf(MSG_INFO,
"TEST: Override OCI KDE frequency %d -> %d MHz",
ci.frequency,
wpa_s->oci_freq_override_wnm_sleep);
ci.frequency = wpa_s->oci_freq_override_wnm_sleep;
}
#endif /* CONFIG_TESTING_OPTIONS */
oci_ie_len = OCV_OCI_EXTENDED_LEN; oci_ie_len = OCV_OCI_EXTENDED_LEN;
oci_ie = os_zalloc(oci_ie_len); oci_ie = os_zalloc(oci_ie_len);

View file

@ -1651,6 +1651,12 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
wpa_s->ft_rsnxe_used); wpa_s->ft_rsnxe_used);
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_EAPOL, wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_EAPOL,
wpa_s->oci_freq_override_eapol); wpa_s->oci_freq_override_eapol);
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_EAPOL_G2,
wpa_s->oci_freq_override_eapol_g2);
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_FT_ASSOC,
wpa_s->oci_freq_override_ft_assoc);
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_FILS_ASSOC,
wpa_s->oci_freq_override_fils_assoc);
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
/* Extended Key ID is only supported in infrastructure BSS so far */ /* Extended Key ID is only supported in infrastructure BSS so far */

View file

@ -1152,6 +1152,10 @@ struct wpa_supplicant {
unsigned int oci_freq_override_eapol; unsigned int oci_freq_override_eapol;
unsigned int oci_freq_override_saquery_req; unsigned int oci_freq_override_saquery_req;
unsigned int oci_freq_override_saquery_resp; unsigned int oci_freq_override_saquery_resp;
unsigned int oci_freq_override_eapol_g2;
unsigned int oci_freq_override_ft_assoc;
unsigned int oci_freq_override_fils_assoc;
unsigned int oci_freq_override_wnm_sleep;
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
struct wmm_ac_assoc_data *wmm_ac_assoc_info; struct wmm_ac_assoc_data *wmm_ac_assoc_info;