]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OCV: OCI channel override support for testing (STA)
authorVeerendranath Jakkam <vjakkam@codeaurora.org>
Fri, 26 Jun 2020 08:19:14 +0000 (13:49 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 3 Aug 2020 08:02:13 +0000 (11:02 +0300)
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>
src/rsn_supp/wpa.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_ft.c
src/rsn_supp/wpa_i.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 63171021f7f22ecb16e28640b1bf3d419bdab45d..7b1218f16eee1bc93b16a24e8060c9a7c5ba6761 100644 (file)
@@ -2039,6 +2039,15 @@ static int wpa_supplicant_send_2_of_2(struct wpa_sm *sm,
                        os_free(rbuf);
                        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 */
                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:
                sm->oci_freq_override_eapol = value;
                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 */
 #ifdef CONFIG_DPP2
        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);
                        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);
                if (ocv_insert_extended_oci(&ci, pos) < 0) {
index 36a17df3dd05daa1838a5bc2a8ba078b170666b4..2142772d730c5f6c4c890d5726bac529ed231d63 100644 (file)
@@ -110,6 +110,9 @@ enum wpa_sm_conf_params {
        WPA_PARAM_FT_RSNXE_USED,
        WPA_PARAM_DPP_PFS,
        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 {
index 00151df59c8ef7f4fabbc1288a1693e13dac2303..bcaf42fe6d64f1c19a7289abf04be650556b0655 100644 (file)
@@ -353,6 +353,14 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
                        os_free(buf);
                        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++ = OCV_OCI_LEN;
index 8d7a7a93a84a947f685dd663222ddfea8fd9c955..96b07fc68baf1145261730d75e9de09ffbe81471 100644 (file)
@@ -156,6 +156,9 @@ struct wpa_sm {
        struct wpabuf *test_assoc_ie;
        int ft_rsnxe_used;
        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 */
 
 #ifdef CONFIG_FILS
index 8d2ccbae536612e9ccc94bf5f78c988918226948..6dfce2aaa8890a01189c4551b009b79a42f2ae5f 100644 (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);
        } else if (os_strcasecmp(cmd, "oci_freq_override_saquery_resp") == 0) {
                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) {
                wpabuf_free(wpa_s->rsne_override_eapol);
                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_saquery_req = 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
        os_free(wpa_s->dpp_config_obj_override);
        wpa_s->dpp_config_obj_override = NULL;
index 411ce886d3536f6c1588bb3f1f2881c5a13d5d9e..d0c9f0f4580ece9d4aad0177e9edbcfe3de5f8d3 100644 (file)
@@ -121,6 +121,15 @@ int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
                        os_free(wnmtfs_ie);
                        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 = os_zalloc(oci_ie_len);
index bda9fe5e4e1575c2f3bec518b76bc2bfc95e6d12..51e5321e00182c2a210b1076e02a2a7d5045423c 100644 (file)
@@ -1651,6 +1651,12 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
                         wpa_s->ft_rsnxe_used);
        wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_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 */
 
        /* Extended Key ID is only supported in infrastructure BSS so far */
index d845ae2ae50c3f9950b40225ed17593fc431862a..6dff477bf40033e668b0b1bfd241a71b6e36c192 100644 (file)
@@ -1152,6 +1152,10 @@ struct wpa_supplicant {
        unsigned int oci_freq_override_eapol;
        unsigned int oci_freq_override_saquery_req;
        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 */
 
        struct wmm_ac_assoc_data *wmm_ac_assoc_info;