From e433d06dd5cc904dcffff4f3d95b43fc4283dbe3 Mon Sep 17 00:00:00 2001 From: "Vinita S. Maloo" Date: Mon, 12 Apr 2021 16:56:24 +0530 Subject: [PATCH] Allow MSCS support to be disabled for testing purposes "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 --- wpa_supplicant/ctrl_iface.c | 3 +++ wpa_supplicant/wpa_supplicant.c | 17 +++++++++++++---- wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 170d8c19c..08b19a3a9 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -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; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index d994de4bf..01e1092cf 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -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; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 6c394fe89..f4b3e0380 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -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;