]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OCV: Add support to override channel info OCI element (STA)
authorVamsi Krishna <vamsin@codeaurora.org>
Fri, 8 May 2020 17:59:04 +0000 (23:29 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 25 May 2020 15:01:44 +0000 (18:01 +0300)
To support the STA testbed role, the STA has to use specified channel
information in OCI element sent to the AP in EAPOL-Key msg 2/4, SA Query
Request, and SA Query Response frames. Add override parameters to use
the specified channel while populating OCI element in all these frames.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/rsn_supp/wpa.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_i.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 28d41760872e4e3ca0967c8fb08251bfb794c989..0e6e2212c11ae5a5c96c22c8514c5c266ed0bbf5 100644 (file)
@@ -756,6 +756,14 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
                                   "Failed to get channel info for OCI element in EAPOL-Key 2/4");
                        goto failed;
                }
+#ifdef CONFIG_TESTING_OPTIONS
+               if (sm->oci_freq_override_eapol) {
+                       wpa_printf(MSG_INFO,
+                                  "TEST: Override OCI KDE frequency %d -> %d MHz",
+                                  ci.frequency, sm->oci_freq_override_eapol);
+                       ci.frequency = sm->oci_freq_override_eapol;
+               }
+#endif /* CONFIG_TESTING_OPTIONS */
 
                if (ocv_insert_oci_kde(&ci, &pos) < 0)
                        goto failed;
@@ -3291,6 +3299,9 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
        case WPA_PARAM_FT_RSNXE_USED:
                sm->ft_rsnxe_used = value;
                break;
+       case WPA_PARAM_OCI_FREQ_EAPOL:
+               sm->oci_freq_override_eapol = value;
+               break;
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_DPP2
        case WPA_PARAM_DPP_PFS:
index dfc156b5514d73e01bd1eecf6c718c248e7a4442..f3901e01b32bb82da35e7c4a66b3ced42059405a 100644 (file)
@@ -108,6 +108,7 @@ enum wpa_sm_conf_params {
        WPA_PARAM_USE_EXT_KEY_ID,
        WPA_PARAM_FT_RSNXE_USED,
        WPA_PARAM_DPP_PFS,
+       WPA_PARAM_OCI_FREQ_EAPOL,
 };
 
 struct rsn_supp_config {
index f7d9f62550b2f19f02ace652b768565a31b2fe04..4db925619b4f56003c3e2e3897af6d9adaa6831b 100644 (file)
@@ -154,6 +154,7 @@ struct wpa_sm {
 #ifdef CONFIG_TESTING_OPTIONS
        struct wpabuf *test_assoc_ie;
        int ft_rsnxe_used;
+       unsigned int oci_freq_override_eapol;
 #endif /* CONFIG_TESTING_OPTIONS */
 
 #ifdef CONFIG_FILS
index 1507c48d21a0a189ee54638cffdb4b53ba827744..ff2f69ea46c0f3ec91988e2a5b26263aae941784 100644 (file)
@@ -751,6 +751,12 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
                }
        } else if (os_strcasecmp(cmd, "ft_rsnxe_used") == 0) {
                wpa_s->ft_rsnxe_used = atoi(value);
+       } else if (os_strcasecmp(cmd, "oci_freq_override_eapol") == 0) {
+               wpa_s->oci_freq_override_eapol = atoi(value);
+       } else if (os_strcasecmp(cmd, "oci_freq_override_saquery_req") == 0) {
+               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, "rsne_override_eapol") == 0) {
                wpabuf_free(wpa_s->rsne_override_eapol);
                if (os_strcmp(value, "NULL") == 0)
@@ -8315,6 +8321,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
        wpabuf_free(wpa_s->rsnxe_override_eapol);
        wpa_s->rsnxe_override_eapol = NULL;
        wpas_clear_driver_signal_override(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;
 #ifdef CONFIG_DPP
        os_free(wpa_s->dpp_config_obj_override);
        wpa_s->dpp_config_obj_override = NULL;
index d06f6e2987f655da22626b66256f3296c26eb4ab..28167cf278e897c96d4e1f46d743f290c1ad7111 100644 (file)
@@ -2573,6 +2573,16 @@ static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s,
                        return;
                }
 
+#ifdef CONFIG_TESTING_OPTIONS
+               if (wpa_s->oci_freq_override_saquery_req) {
+                       wpa_printf(MSG_INFO,
+                                  "TEST: Override SA Query Request OCI frequency %d -> %d MHz",
+                                  ci.frequency,
+                                  wpa_s->oci_freq_override_saquery_req);
+                       ci.frequency = wpa_s->oci_freq_override_saquery_req;
+               }
+#endif /* CONFIG_TESTING_OPTIONS */
+
                if (ocv_insert_extended_oci(&ci, req + req_len) < 0)
                        return;
 
@@ -2727,6 +2737,16 @@ static void sme_process_sa_query_request(struct wpa_supplicant *wpa_s,
                        return;
                }
 
+#ifdef CONFIG_TESTING_OPTIONS
+               if (wpa_s->oci_freq_override_saquery_resp) {
+                       wpa_printf(MSG_INFO,
+                                  "TEST: Override SA Query Response OCI frequency %d -> %d MHz",
+                                  ci.frequency,
+                                  wpa_s->oci_freq_override_saquery_resp);
+                       ci.frequency = wpa_s->oci_freq_override_saquery_resp;
+               }
+#endif /* CONFIG_TESTING_OPTIONS */
+
                if (ocv_insert_extended_oci(&ci, resp + resp_len) < 0)
                        return;
 
index af4e7eb3af6c4f801306414b34ec4b9b3e3d8807..acd0091bc8a916bb129d2e3612a1ae1892e829f4 100644 (file)
@@ -1642,6 +1642,8 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_TESTING_OPTIONS
        wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_FT_RSNXE_USED,
                         wpa_s->ft_rsnxe_used);
+       wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCI_FREQ_EAPOL,
+                        wpa_s->oci_freq_override_eapol);
 #endif /* CONFIG_TESTING_OPTIONS */
 
        /* Extended Key ID is only supported in infrastructure BSS so far */
index 734ba0797f900d7529cc673d396861916a3e950a..28867f04ec23e8ff364837a79378fca605390a71 100644 (file)
@@ -1149,6 +1149,9 @@ struct wpa_supplicant {
        struct wpabuf *rsnxe_override_assoc;
        struct wpabuf *rsnxe_override_eapol;
        struct dl_list drv_signal_override;
+       unsigned int oci_freq_override_eapol;
+       unsigned int oci_freq_override_saquery_req;
+       unsigned int oci_freq_override_saquery_resp;
 #endif /* CONFIG_TESTING_OPTIONS */
 
        struct wmm_ac_assoc_data *wmm_ac_assoc_info;