From 32b5f7f501e48e32b412700edf861868f614bed8 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 28 Nov 2023 00:33:58 +0530 Subject: [PATCH] Add an option to remove Robust AV (SCS, MSCS, QoS Management) For a memory constrained system, it may be more important to reduce binary size than include support for these capabilities. By default this is enabled. Signed-off-by: Chaitanya Tata --- wpa_supplicant/Android.mk | 7 ++++++- wpa_supplicant/Makefile | 7 ++++++- wpa_supplicant/android.config | 4 ++++ wpa_supplicant/ctrl_iface.c | 24 +++++++++++++++++++++--- wpa_supplicant/defconfig | 4 ++++ wpa_supplicant/events.c | 6 ++++++ wpa_supplicant/sme.c | 2 ++ wpa_supplicant/wpa_supplicant.c | 18 ++++++++++++++++++ wpa_supplicant/wpa_supplicant_i.h | 30 +++++++++++++++++------------- 9 files changed, 84 insertions(+), 18 deletions(-) diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index 83922621b..8fccfe7cf 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -102,7 +102,6 @@ OBJS += src/utils/ip_addr.c OBJS += src/utils/crc32.c OBJS += wmm_ac.c OBJS += twt.c -OBJS += robust_av.c OBJS_p = wpa_passphrase.c OBJS_p += src/utils/common.c OBJS_p += src/utils/wpa_debug.c @@ -431,6 +430,12 @@ endif OBJS += op_classes.c endif +ifdef CONFIG_NO_ROBUST_AV +L_CFLAGS += -DCONFIG_NO_ROBUST_AV +else +OBJS += robust_av.c +endif + include $(LOCAL_PATH)/src/drivers/drivers.mk diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 2be4a5d76..819a0dd88 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -112,7 +112,6 @@ OBJS += ../src/utils/bitfield.o OBJS += ../src/utils/ip_addr.o OBJS += ../src/utils/crc32.o OBJS += twt.o -OBJS += robust_av.o OBJS_p = wpa_passphrase.o OBJS_p += ../src/utils/common.o OBJS_p += ../src/utils/wpa_debug.o @@ -481,6 +480,12 @@ endif OBJS += op_classes.o endif +ifdef CONFIG_NO_ROBUST_AV +CFLAGS += -DCONFIG_NO_ROBUST_AV +else +OBJS += robust_av.o +endif + include ../src/drivers/drivers.mak ifdef CONFIG_AP OBJS_d += $(DRV_BOTH_OBJS) diff --git a/wpa_supplicant/android.config b/wpa_supplicant/android.config index c2da557c9..55ddb2a6d 100644 --- a/wpa_supplicant/android.config +++ b/wpa_supplicant/android.config @@ -547,4 +547,8 @@ CONFIG_WEP=y # AP manage the network and STA steering. #CONFIG_NO_RRM=y +# Disable support for Robust AV streaming for consumer and enterprise Wi-Fi +# applications; IEEE Std 802.11-2020, 4.3.24; SCS, MSCS, QoS Management +#CONFIG_NO_ROBUST_AV=y + include $(wildcard $(LOCAL_PATH)/android_config_*.inc) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index a46c12a3f..1167dd48d 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -833,10 +833,12 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s, wpa_s->sae_commit_override = wpabuf_parse_bin(value); } else if (os_strcasecmp(cmd, "driver_signal_override") == 0) { ret = wpas_ctrl_iface_set_dso(wpa_s, value); +#ifndef CONFIG_NO_ROBUST_AV } 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); +#endif /* CONFIG_NO_ROBUST_AV */ } else if (os_strcasecmp(cmd, "disable_eapol_g2_tx") == 0) { wpa_s->disable_eapol_g2_tx = !!atoi(value); /* Populate value to wpa_sm if already associated. */ @@ -932,8 +934,10 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s, return -1; wnm_set_coloc_intf_elems(wpa_s, elems); #endif /* CONFIG_WNM */ +#ifndef CONFIG_NO_ROBUST_AV } else if (os_strcasecmp(cmd, "enable_dscp_policy_capa") == 0) { wpa_s->enable_dscp_policy_capa = !!atoi(value); +#endif /* CONFIG_NO_ROBUST_AV */ } else { value[-1] = '='; ret = wpa_config_process_global(wpa_s->conf, cmd, -1); @@ -8880,9 +8884,11 @@ 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); +#ifndef CONFIG_NO_ROBUST_AV wpa_s->disable_scs_support = 0; wpa_s->disable_mscs_support = 0; wpa_s->enable_dscp_policy_capa = 0; +#endif /* CONFIG_NO_ROBUST_AV */ wpa_s->oci_freq_override_eapol = 0; wpa_s->oci_freq_override_saquery_req = 0; wpa_s->oci_freq_override_saquery_resp = 0; @@ -8911,7 +8917,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->next_scan_bssid_wildcard_ssid = 0; os_free(wpa_s->select_network_scan_freqs); wpa_s->select_network_scan_freqs = NULL; +#ifndef CONFIG_NO_ROBUST_AV os_memset(&wpa_s->robust_av, 0, sizeof(struct robust_av_data)); +#endif /* CONFIG_NO_ROBUST_AV */ wpa_bss_flush(wpa_s); if (!dl_list_empty(&wpa_s->bss)) { @@ -8938,7 +8946,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) free_bss_tmp_disallowed(wpa_s); +#ifndef CONFIG_NO_ROBUST_AV os_memset(&wpa_s->robust_av, 0, sizeof(struct robust_av_data)); +#endif /* CONFIG_NO_ROBUST_AV */ #ifdef CONFIG_PASN wpas_pasn_auth_stop(wpa_s); @@ -11005,6 +11015,7 @@ int wpas_ctrl_cmd_debug_level(const char *cmd) } +#ifndef CONFIG_NO_ROBUST_AV static int wpas_ctrl_iface_configure_mscs(struct wpa_supplicant *wpa_s, const char *cmd) { @@ -11073,6 +11084,7 @@ static int wpas_ctrl_iface_configure_mscs(struct wpa_supplicant *wpa_s, return wpas_send_mscs_req(wpa_s); } +#endif /* CONFIG_NO_ROBUST_AV */ #ifdef CONFIG_PASN @@ -11177,6 +11189,8 @@ static int wpas_ctrl_iface_pasn_deauthenticate(struct wpa_supplicant *wpa_s, #endif /* CONFIG_PASN */ +#ifndef CONFIG_NO_ROBUST_AV + static int set_type4_frame_classifier(const char *cmd, struct type4_params *param) { @@ -11873,6 +11887,8 @@ static int wpas_ctrl_iface_send_dscp_query(struct wpa_supplicant *wpa_s, return wpas_send_dscp_query(wpa_s, pos + 12, os_strlen(pos + 12)); } +#endif /* CONFIG_NO_ROBUST_AV */ + static int wpas_ctrl_iface_mlo_signal_poll(struct wpa_supplicant *wpa_s, char *buf, size_t buflen) @@ -13054,9 +13070,6 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = -1; #endif /* CONFIG_DPP3 */ #endif /* CONFIG_DPP */ - } else if (os_strncmp(buf, "MSCS ", 5) == 0) { - if (wpas_ctrl_iface_configure_mscs(wpa_s, buf + 5)) - reply_len = -1; #ifdef CONFIG_PASN } else if (os_strncmp(buf, "PASN_START ", 11) == 0) { if (wpas_ctrl_iface_pasn_start(wpa_s, buf + 11) < 0) @@ -13069,6 +13082,10 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, if (wpas_ctrl_iface_pasn_deauthenticate(wpa_s, buf + 12) < 0) reply_len = -1; #endif /* CONFIG_PASN */ +#ifndef CONFIG_NO_ROBUST_AV + } else if (os_strncmp(buf, "MSCS ", 5) == 0) { + if (wpas_ctrl_iface_configure_mscs(wpa_s, buf + 5)) + reply_len = -1; } else if (os_strncmp(buf, "SCS ", 4) == 0) { if (wpas_ctrl_iface_configure_scs(wpa_s, buf + 4)) reply_len = -1; @@ -13078,6 +13095,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "DSCP_QUERY ", 11) == 0) { if (wpas_ctrl_iface_send_dscp_query(wpa_s, buf + 11)) reply_len = -1; +#endif /* CONFIG_NO_ROBUST_AV */ } else if (os_strcmp(buf, "MLO_STATUS") == 0) { reply_len = wpas_ctrl_iface_mlo_status(wpa_s, reply, reply_size); diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig index 27ca6ba40..4f9d9b6a8 100644 --- a/wpa_supplicant/defconfig +++ b/wpa_supplicant/defconfig @@ -676,3 +676,7 @@ CONFIG_DPP2=y # class indication. Removing these is not recommended since they can help the # AP manage the network and STA steering. #CONFIG_NO_RRM=y + +# Disable support for Robust AV streaming for consumer and enterprise Wi-Fi +# applications; IEEE Std 802.11-2020, 4.3.24; SCS, MSCS, QoS Management +#CONFIG_NO_ROBUST_AV=y diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index ad3dcd9d3..96e706e4a 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3546,10 +3546,12 @@ no_pfs: data->assoc_info.resp_ies_len); #endif /* CONFIG_IEEE80211R */ +#ifndef CONFIG_NO_ROBUST_AV if (bssid_known) wpas_handle_assoc_resp_mscs(wpa_s, bssid, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len); +#endif /* CONFIG_NO_ROBUST_AV */ /* WPA/RSN IE from Beacon/ProbeResp */ p = data->assoc_info.beacon_ies; @@ -3604,8 +3606,10 @@ no_pfs: wpa_s->assoc_freq = data->assoc_info.freq; +#ifndef CONFIG_NO_ROBUST_AV wpas_handle_assoc_resp_qos_mgmt(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len); +#endif /* CONFIG_NO_ROBUST_AV */ return 0; } @@ -5342,6 +5346,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_DPP */ +#ifndef CONFIG_NO_ROBUST_AV if (category == WLAN_ACTION_ROBUST_AV_STREAMING && payload[0] == ROBUST_AV_SCS_RESP) { wpas_handle_robust_av_scs_recv_action(wpa_s, mgmt->sa, @@ -5362,6 +5367,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, payload + 4, plen - 4); return; } +#endif /* CONFIG_NO_ROBUST_AV */ wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid, category, payload, plen, freq); diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 5e3ddafc0..648d08549 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -2360,6 +2360,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, pfs_fail: #endif /* CONFIG_DPP2 */ +#ifndef CONFIG_NO_ROBUST_AV wpa_s->mscs_setup_done = false; if (wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS) && wpa_s->robust_av.valid_config) { @@ -2393,6 +2394,7 @@ pfs_fail: wpabuf_free(mscs_ie); } mscs_fail: +#endif /* CONFIG_NO_ROBUST_AV */ if (ssid && ssid->multi_ap_backhaul_sta) { size_t multi_ap_ie_len; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 95a9de614..24f3e0bc0 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -749,8 +749,10 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) #ifdef CONFIG_PASN wpas_pasn_auth_stop(wpa_s); #endif /* CONFIG_PASN */ +#ifndef CONFIG_NO_ROBUST_AV wpas_scs_deinit(wpa_s); wpas_dscp_deinit(wpa_s); +#endif /* CONFIG_NO_ROBUST_AV */ #ifdef CONFIG_OWE os_free(wpa_s->owe_trans_scan_freq); @@ -2094,7 +2096,9 @@ 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, struct wpa_bss *bss) { +#ifndef CONFIG_NO_ROBUST_AV bool scs = true, mscs = true; +#endif /* CONFIG_NO_ROBUST_AV */ *pos = 0x00; @@ -2139,6 +2143,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx, #endif /* CONFIG_MBO */ break; case 6: /* Bits 48-55 */ +#ifndef CONFIG_NO_ROBUST_AV #ifdef CONFIG_TESTING_OPTIONS if (wpa_s->disable_scs_support) scs = false; @@ -2152,6 +2157,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx, } if (scs) *pos |= 0x40; /* Bit 54 - SCS */ +#endif /* CONFIG_NO_ROBUST_AV */ break; case 7: /* Bits 56-63 */ break; @@ -2168,6 +2174,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx, #endif /* CONFIG_FILS */ break; case 10: /* Bits 80-87 */ +#ifndef CONFIG_NO_ROBUST_AV #ifdef CONFIG_TESTING_OPTIONS if (wpa_s->disable_mscs_support) mscs = false; @@ -2181,6 +2188,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx, } if (mscs) *pos |= 0x20; /* Bit 85 - Mirrored SCS */ +#endif /* CONFIG_NO_ROBUST_AV */ break; } } @@ -3236,8 +3244,10 @@ static int wpas_populate_wfa_capa(struct wpa_supplicant *wpa_s, size_t wfa_ie_len, buf_len; os_memset(wfa_capa, 0, sizeof(wfa_capa)); +#ifndef CONFIG_NO_ROBUST_AV if (wpa_s->enable_dscp_policy_capa) wfa_capa[0] |= WFA_CAPA_QM_DSCP_POLICY; +#endif /* CONFIG_NO_ROBUST_AV */ if (wpa_is_non_eht_scs_traffic_desc_supported(bss)) wfa_capa[0] |= WFA_CAPA_QM_NON_EHT_SCS_TRAFFIC_DESC; @@ -3732,6 +3742,7 @@ pfs_fail: wpa_ie_len += wpa_s->rsnxe_len; } +#ifndef CONFIG_NO_ROBUST_AV #ifdef CONFIG_TESTING_OPTIONS if (wpa_s->disable_mscs_support) goto mscs_end; @@ -3766,6 +3777,7 @@ pfs_fail: wpabuf_free(mscs_ie); } mscs_end: +#endif /* CONFIG_NO_ROBUST_AV */ wpa_ie_len = wpas_populate_wfa_capa(wpa_s, bss, wpa_ie, wpa_ie_len, max_wpa_ie_len); @@ -4050,7 +4062,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0); wpa_s->rsnxe_len = 0; +#ifndef CONFIG_NO_ROBUST_AV wpa_s->mscs_setup_done = false; +#endif /* CONFIG_NO_ROBUST_AV */ wpa_ie = wpas_populate_assoc_ies(wpa_s, bss, ssid, ¶ms, NULL); if (!wpa_ie) { @@ -4515,8 +4529,10 @@ static void wpa_supplicant_clear_connection(struct wpa_supplicant *wpa_s, if (old_ssid != wpa_s->current_ssid) wpas_notify_network_changed(wpa_s); +#ifndef CONFIG_NO_ROBUST_AV wpas_scs_deinit(wpa_s); wpas_dscp_deinit(wpa_s); +#endif /* CONFIG_NO_ROBUST_AV */ eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); } @@ -5822,7 +5838,9 @@ wpa_supplicant_alloc(struct wpa_supplicant *parent) #ifdef CONFIG_TESTING_OPTIONS dl_list_init(&wpa_s->drv_signal_override); #endif /* CONFIG_TESTING_OPTIONS */ +#ifndef CONFIG_NO_ROBUST_AV dl_list_init(&wpa_s->active_scs_ids); +#endif /* CONFIG_NO_ROBUST_AV */ wpa_s->ml_probe_mld_id = -1; return wpa_s; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 35a9c0c9e..539c0bc66 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1547,8 +1547,24 @@ struct wpa_supplicant { unsigned int multi_ap_ie:1; unsigned int multi_ap_backhaul:1; unsigned int multi_ap_fronthaul:1; + +#ifndef CONFIG_NO_ROBUST_AV struct robust_av_data robust_av; bool mscs_setup_done; + struct scs_robust_av_data scs_robust_av_req; + u8 scs_dialog_token; + struct dl_list active_scs_ids; + bool ongoing_scs_req; + u8 dscp_req_dialog_token; + u8 dscp_query_dialog_token; + unsigned int enable_dscp_policy_capa:1; + unsigned int connection_dscp:1; + unsigned int wait_for_dscp_req:1; +#ifdef CONFIG_TESTING_OPTIONS + unsigned int disable_scs_support:1; + unsigned int disable_mscs_support:1; +#endif /* CONFIG_TESTING_OPTIONS */ +#endif /* CONFIG_NO_ROBUST_AV */ bool wps_scan_done; /* Set upon receiving scan results event */ bool supp_pbc_active; /* Set for interface when PBC is triggered */ @@ -1560,19 +1576,7 @@ struct wpa_supplicant { unsigned int pasn_count; struct pasn_auth *pasn_params; #endif /* CONFIG_PASN */ - struct scs_robust_av_data scs_robust_av_req; - 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; - u8 dscp_req_dialog_token; - u8 dscp_query_dialog_token; - unsigned int enable_dscp_policy_capa:1; - unsigned int connection_dscp:1; - unsigned int wait_for_dscp_req:1; + bool is_6ghz_enabled; bool crossed_6ghz_dom; bool last_scan_all_chan;