]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow MSCS support to be disabled for testing purposes
authorVinita S. Maloo <vmaloo@codeaurora.org>
Mon, 12 Apr 2021 11:26:24 +0000 (16:56 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 12 Aug 2021 15:28:07 +0000 (18:28 +0300)
"SET disable_mscs_support 1" can be used to disable indication of MSCS
support in the Extended Capabilities element for testing purposes. This
is also disabling addition of the MSCS element even if valid
configuration parameters had been configured.

Signed-off-by: Vinita S. Maloo <vmaloo@codeaurora.org>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 170d8c19c701ec34d72f841c527393d8d83febe1..08b19a3a92d070d82e039809acb4671008a39b51 100644 (file)
@@ -832,6 +832,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
                ret = wpas_ctrl_iface_set_dso(wpa_s, value);
        } else if (os_strcasecmp(cmd, "disable_scs_support") == 0) {
                wpa_s->disable_scs_support = !!atoi(value);
+       } else if (os_strcasecmp(cmd, "disable_mscs_support") == 0) {
+               wpa_s->disable_mscs_support = !!atoi(value);
 #ifdef CONFIG_DPP
        } else if (os_strcasecmp(cmd, "dpp_config_obj_override") == 0) {
                os_free(wpa_s->dpp_config_obj_override);
@@ -8554,6 +8556,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
        wpa_s->rsnxe_override_eapol = NULL;
        wpas_clear_driver_signal_override(wpa_s);
        wpa_s->disable_scs_support = 0;
+       wpa_s->disable_mscs_support = 0;
        wpa_s->oci_freq_override_eapol = 0;
        wpa_s->oci_freq_override_saquery_req = 0;
        wpa_s->oci_freq_override_saquery_resp = 0;
index d994de4bf9ba0e0a90bef4c74871ce016cc9d539..01e1092cfa825a4ba29dd76ec6a01922aa5467ee 100644 (file)
@@ -1873,7 +1873,7 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
 
 static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
 {
-       bool scs = true;
+       bool scs = true, mscs = true;
 
        *pos = 0x00;
 
@@ -1940,7 +1940,12 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
 #endif /* CONFIG_FILS */
                break;
        case 10: /* Bits 80-87 */
-               *pos |= 0x20; /* Bit 85 - Mirrored SCS */
+#ifdef CONFIG_TESTING_OPTIONS
+               if (wpa_s->disable_mscs_support)
+                       mscs = false;
+#endif /* CONFIG_TESTING_OPTIONS */
+               if (mscs)
+                       *pos |= 0x20; /* Bit 85 - Mirrored SCS */
                break;
        }
 }
@@ -3239,6 +3244,10 @@ pfs_fail:
                wpa_ie_len += wpa_s->rsnxe_len;
        }
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (wpa_s->disable_mscs_support)
+               goto mscs_end;
+#endif /* CONFIG_TESTING_OPTIONS */
        if (wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_MSCS) &&
            wpa_s->robust_av.valid_config) {
                struct wpabuf *mscs_ie;
@@ -3254,7 +3263,7 @@ pfs_fail:
                if (!mscs_ie) {
                        wpa_printf(MSG_INFO,
                                   "MSCS: Failed to allocate MSCS IE");
-                       goto mscs_fail;
+                       goto mscs_end;
                }
 
                wpas_populate_mscs_descriptor_ie(&wpa_s->robust_av, mscs_ie);
@@ -3268,7 +3277,7 @@ pfs_fail:
 
                wpabuf_free(mscs_ie);
        }
-mscs_fail:
+mscs_end:
 
        if (ssid->multi_ap_backhaul_sta) {
                size_t multi_ap_ie_len;
index 6c394fe89f10e7a8066b02cee5f0868fc98e27ef..f4b3e03804af52c5ff4925018e541bf7d5ae7d6f 100644 (file)
@@ -1493,6 +1493,7 @@ struct wpa_supplicant {
        u8 scs_dialog_token;
 #ifdef CONFIG_TESTING_OPTIONS
        unsigned int disable_scs_support:1;
+       unsigned int disable_mscs_support:1;
 #endif /* CONFIG_TESTING_OPTIONS */
        struct dl_list active_scs_ids;
        bool ongoing_scs_req;