From 2158811ed6d4649d2a6e27ae89da5c6d249dd61c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 11 Oct 2023 20:20:44 +0530 Subject: [PATCH] [nrf fromlist] wpa_supplicant: Add an option to remove advanced features For a memory constrained system, basic Wi-Fi is enough, so, add a configuration option to compiled out advanced Wi-Fi features. Note: wpa_cli_cmds.c changes are [noup]. Upstream PR: https://patchwork.ozlabs.org/project/hostap/patch/20231011151937.157323-1-Chaitanya.Tata@nordicsemi.no/ Signed-off-by: Chaitanya Tata --- hostapd/ctrl_iface.c | 2 + wpa_supplicant/ctrl_iface.c | 167 ++++++++++++++++-------------- wpa_supplicant/events.c | 18 +++- wpa_supplicant/scan.c | 3 +- wpa_supplicant/sme.c | 7 +- wpa_supplicant/wpa_cli_cmds.c | 8 +- wpa_supplicant/wpa_supplicant.c | 35 ++++++- wpa_supplicant/wpa_supplicant_i.h | 22 ++-- 8 files changed, 159 insertions(+), 103 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 29dc38aba..d8486ca95 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1541,12 +1541,14 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) hostapd_disassoc_deny_mac(hapd); } else if (os_strcasecmp(cmd, "accept_mac_file") == 0) { hostapd_disassoc_accept_mac(hapd); +#ifdef CONFIG_WMM_AC } else if (os_strncmp(cmd, "wme_ac_", 7) == 0 || os_strncmp(cmd, "wmm_ac_", 7) == 0) { hapd->parameter_set_count++; if (ieee802_11_update_beacons(hapd->iface)) wpa_printf(MSG_DEBUG, "Failed to update beacons with WMM parameters"); +#endif /* CONFIG_WMM_AC */ } else if (os_strcmp(cmd, "wpa_passphrase") == 0 || os_strcmp(cmd, "sae_password") == 0 || os_strcmp(cmd, "sae_pwe") == 0) { diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 6b9fdd4fc..a717189a9 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -922,8 +922,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 */ +#ifdef CONFIG_ROBUST_AV } else if (os_strcasecmp(cmd, "enable_dscp_policy_capa") == 0) { wpa_s->enable_dscp_policy_capa = !!atoi(value); +#endif /* CONFIG_ROBUST_AV */ } else { value[-1] = '='; ret = wpa_config_process_global(wpa_s->conf, cmd, -1); @@ -1250,6 +1252,7 @@ static int wpa_supplicant_ctrl_iface_tdls_link_status( #endif /* CONFIG_TDLS */ +#ifdef CONFIG_WMM_AC static int wmm_ac_ctrl_addts(struct wpa_supplicant *wpa_s, char *cmd) { char *token, *context = NULL; @@ -1298,7 +1301,7 @@ static int wmm_ac_ctrl_delts(struct wpa_supplicant *wpa_s, char *cmd) return wpas_wmm_ac_delts(wpa_s, tsid); } - +#endif /* CONFIG_WMM_AC */ #ifdef CONFIG_IEEE80211R static int wpa_supplicant_ctrl_iface_ft_ds( @@ -8001,7 +8004,6 @@ static int wpas_ctrl_iface_wnm_bss_query(struct wpa_supplicant *wpa_s, char *cmd list); } - static int wpas_ctrl_iface_coloc_intf_report(struct wpa_supplicant *wpa_s, char *cmd) { @@ -8555,7 +8557,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; +#ifdef CONFIG_ROBUST_AV os_memset(&wpa_s->robust_av, 0, sizeof(struct robust_av_data)); +#endif /* CONFIG_ROBUST_AV */ wpa_bss_flush(wpa_s); if (!dl_list_empty(&wpa_s->bss)) { @@ -8582,7 +8586,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) free_bss_tmp_disallowed(wpa_s); +#ifdef CONFIG_ROBUST_AV os_memset(&wpa_s->robust_av, 0, sizeof(struct robust_av_data)); +#endif /* CONFIG_ROBUST_AV */ #ifdef CONFIG_PASN wpas_pasn_auth_stop(wpa_s); @@ -10204,7 +10210,7 @@ static int wpas_ctrl_vendor_elem_remove(struct wpa_supplicant *wpa_s, char *cmd) return res; } - +#ifdef CONFIG_RRM static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep) { struct wpa_supplicant *wpa_s = ctx; @@ -10307,7 +10313,6 @@ static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep) wpabuf_free(neighbor_rep); } - static int wpas_ctrl_iface_send_neighbor_rep(struct wpa_supplicant *wpa_s, char *cmd) { @@ -10347,7 +10352,7 @@ static int wpas_ctrl_iface_send_neighbor_rep(struct wpa_supplicant *wpa_s, return ret; } - +#endif /* CONFIG_RRM */ static int wpas_ctrl_iface_erp_flush(struct wpa_supplicant *wpa_s) { @@ -10700,76 +10705,6 @@ static int wpas_ctrl_cmd_debug_level(const char *cmd) } #endif -static int wpas_ctrl_iface_configure_mscs(struct wpa_supplicant *wpa_s, - const char *cmd) -{ - size_t frame_classifier_len; - const char *pos, *end; - struct robust_av_data *robust_av = &wpa_s->robust_av; - int val; - - /* - * format: - * [up_bitmap=] [up_limit=] - * [stream_timeout=] [frame_classifier=] - */ - os_memset(robust_av, 0, sizeof(struct robust_av_data)); - if (os_strncmp(cmd, "add ", 4) == 0) { - robust_av->request_type = SCS_REQ_ADD; - } else if (os_strcmp(cmd, "remove") == 0) { - robust_av->request_type = SCS_REQ_REMOVE; - robust_av->valid_config = false; - return wpas_send_mscs_req(wpa_s); - } else if (os_strncmp(cmd, "change ", 7) == 0) { - robust_av->request_type = SCS_REQ_CHANGE; - } else { - return -1; - } - - pos = os_strstr(cmd, "up_bitmap="); - if (!pos) - return -1; - - val = hex2byte(pos + 10); - if (val < 0) - return -1; - robust_av->up_bitmap = val; - - pos = os_strstr(cmd, "up_limit="); - if (!pos) - return -1; - - robust_av->up_limit = atoi(pos + 9); - - pos = os_strstr(cmd, "stream_timeout="); - if (!pos) - return -1; - - robust_av->stream_timeout = atoi(pos + 15); - if (robust_av->stream_timeout == 0) - return -1; - - pos = os_strstr(cmd, "frame_classifier="); - if (!pos) - return -1; - - pos += 17; - end = os_strchr(pos, ' '); - if (!end) - end = pos + os_strlen(pos); - - frame_classifier_len = (end - pos) / 2; - if (frame_classifier_len > sizeof(robust_av->frame_classifier) || - hexstr2bin(pos, robust_av->frame_classifier, frame_classifier_len)) - return -1; - - robust_av->frame_classifier_len = frame_classifier_len; - robust_av->valid_config = true; - - return wpas_send_mscs_req(wpa_s); -} - - #ifdef CONFIG_PASN static int wpas_ctrl_iface_pasn_start(struct wpa_supplicant *wpa_s, char *cmd) { @@ -10869,6 +10804,75 @@ static int wpas_ctrl_iface_pasn_deauthenticate(struct wpa_supplicant *wpa_s, #endif /* CONFIG_PASN */ +#ifdef CONFIG_ROBUST_AV +static int wpas_ctrl_iface_configure_mscs(struct wpa_supplicant *wpa_s, + const char *cmd) +{ + size_t frame_classifier_len; + const char *pos, *end; + struct robust_av_data *robust_av = &wpa_s->robust_av; + int val; + + /* + * format: + * [up_bitmap=] [up_limit=] + * [stream_timeout=] [frame_classifier=] + */ + os_memset(robust_av, 0, sizeof(struct robust_av_data)); + if (os_strncmp(cmd, "add ", 4) == 0) { + robust_av->request_type = SCS_REQ_ADD; + } else if (os_strcmp(cmd, "remove") == 0) { + robust_av->request_type = SCS_REQ_REMOVE; + robust_av->valid_config = false; + return wpas_send_mscs_req(wpa_s); + } else if (os_strncmp(cmd, "change ", 7) == 0) { + robust_av->request_type = SCS_REQ_CHANGE; + } else { + return -1; + } + + pos = os_strstr(cmd, "up_bitmap="); + if (!pos) + return -1; + + val = hex2byte(pos + 10); + if (val < 0) + return -1; + robust_av->up_bitmap = val; + + pos = os_strstr(cmd, "up_limit="); + if (!pos) + return -1; + + robust_av->up_limit = atoi(pos + 9); + + pos = os_strstr(cmd, "stream_timeout="); + if (!pos) + return -1; + + robust_av->stream_timeout = atoi(pos + 15); + if (robust_av->stream_timeout == 0) + return -1; + + pos = os_strstr(cmd, "frame_classifier="); + if (!pos) + return -1; + + pos += 17; + end = os_strchr(pos, ' '); + if (!end) + end = pos + os_strlen(pos); + + frame_classifier_len = (end - pos) / 2; + if (frame_classifier_len > sizeof(robust_av->frame_classifier) || + hexstr2bin(pos, robust_av->frame_classifier, frame_classifier_len)) + return -1; + + robust_av->frame_classifier_len = frame_classifier_len; + robust_av->valid_config = true; + + return wpas_send_mscs_req(wpa_s); +} static int set_type4_frame_classifier(const char *cmd, struct type4_params *param) @@ -11443,6 +11447,7 @@ 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_ROBUST_AV */ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, @@ -12065,6 +12070,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = wpa_supplicant_ctrl_iface_tdls_link_status( wpa_s, buf + 17, reply, reply_size); #endif /* CONFIG_TDLS */ +#ifdef CONFIG_WMM_AC } else if (os_strcmp(buf, "WMM_AC_STATUS") == 0) { reply_len = wpas_wmm_ac_status(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "WMM_AC_ADDTS ", 13) == 0) { @@ -12073,6 +12079,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "WMM_AC_DELTS ", 13) == 0) { if (wmm_ac_ctrl_delts(wpa_s, buf + 13)) reply_len = -1; +#endif /* CONFIG_WMM_AC */ } else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) { reply_len = wpa_supplicant_signal_poll(wpa_s, reply, reply_size); @@ -12198,9 +12205,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "VENDOR_ELEM_REMOVE ", 19) == 0) { if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0) reply_len = -1; +#ifdef CONFIG_RRM } else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) { if (wpas_ctrl_iface_send_neighbor_rep(wpa_s, buf + 20)) reply_len = -1; +#endif /* CONFIG_RRM */ } else if (os_strcmp(buf, "ERP_FLUSH") == 0) { wpas_ctrl_iface_erp_flush(wpa_s); } else if (os_strncmp(buf, "MAC_RAND_SCAN ", 14) == 0) { @@ -12365,9 +12374,6 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = -1; #endif /* CONFIG_DPP2 */ #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) @@ -12380,6 +12386,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 */ +#ifdef CONFIG_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; @@ -12389,6 +12399,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_ROBUST_AV */ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); reply_len = 16; diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 579e87947..97a1a0386 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -339,7 +339,9 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s) eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); wpa_s->key_mgmt = 0; +#ifdef CONFIG_RRM wpas_rrm_reset(wpa_s); +#endif /* CONFIG_RRM */ wpa_s->wnmsleep_used = 0; wnm_clear_coloc_intf_reporting(wpa_s); wpa_s->disable_mbo_oce = 0; @@ -2184,9 +2186,11 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, if (sme_proc_obss_scan(wpa_s) > 0) goto scan_work_done; +#ifdef CONFIG_RRM if (own_request && data && wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0) goto scan_work_done; +#endif /* CONFIG_RRM */ if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) goto scan_work_done; @@ -3144,10 +3148,12 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, data->assoc_info.resp_ies_len); #endif /* CONFIG_IEEE80211R */ +#ifdef CONFIG_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_ROBUST_AV */ /* WPA/RSN IE from Beacon/ProbeResp */ p = data->assoc_info.beacon_ies; @@ -3202,8 +3208,10 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, wpa_s->assoc_freq = data->assoc_info.freq; +#ifdef CONFIG_ROBUST_AV wpas_handle_assoc_resp_qos_mgmt(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len); +#endif /* CONFIG_ROBUST_AV */ return 0; } @@ -3524,6 +3532,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, wpas_wps_notify_assoc(wpa_s, bssid); +#ifdef CONFIG_WMM_AC if (data) { wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies, data->assoc_info.resp_ies_len, @@ -3532,6 +3541,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, if (wpa_s->reassoc_same_bss) wmm_ac_restore_tspecs(wpa_s); } +#endif /* CONFIG_WMM_AC */ #if defined(CONFIG_FILS) || defined(CONFIG_MBO) bss = wpa_bss_get_bssid(wpa_s, bssid); @@ -4384,10 +4394,12 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, " Category=%u DataLen=%d freq=%d MHz", MAC2STR(mgmt->sa), category, (int) plen, freq); +#ifdef CONFIG_WMM_AC if (category == WLAN_ACTION_WMM) { wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen); return; } +#endif /* CONFIG_WMM_AC */ #ifdef CONFIG_IEEE80211R if (category == WLAN_ACTION_FT) { @@ -4453,6 +4465,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_INTERWORKING */ +#ifdef CONFIG_RRM if (category == WLAN_ACTION_RADIO_MEASUREMENT && payload[0] == WLAN_RRM_RADIO_MEASUREMENT_REQUEST) { wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa, @@ -4475,6 +4488,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, rssi); return; } +#endif /* CONFIG_RRM */ #ifdef CONFIG_FST if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) { @@ -4494,7 +4508,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, return; } #endif /* CONFIG_DPP */ - +#ifdef CONFIG_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, @@ -4515,7 +4529,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, payload + 4, plen - 4); return; } - +#endif /* CONFIG_ROBUST_AV */ wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid, category, payload, plen, freq); if (wpa_s->ifmsh) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index d3bffa098..7d014f962 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -258,9 +258,10 @@ static void wpas_trigger_scan_cb(struct wpa_radio_work *work, int deinit) /* Clear the scan_res_handler */ wpa_s->scan_res_handler = NULL; } - +#ifdef CONFIG_RRM if (wpa_s->beacon_rep_data.token) wpas_rrm_refuse_request(wpa_s); +#endif /* CONFIG_RRM */ return; } diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 8126c2982..14f1f0858 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -622,11 +622,12 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, sme_auth_handle_rrm(wpa_s, bss); +#ifdef CONFIG_RRM wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie( wpa_s, ssid, bss, wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len); - +#endif /* CONFIG_RRM */ if (params.p2p) wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT); else @@ -1907,7 +1908,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, } pfs_fail: #endif /* CONFIG_DPP2 */ - +#ifdef CONFIG_RRM 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) { @@ -1941,7 +1942,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, wpabuf_free(mscs_ie); } mscs_fail: - +#endif /* CONFIG_RRM */ if (ssid && ssid->multi_ap_backhaul_sta) { size_t multi_ap_ie_len; diff --git a/wpa_supplicant/wpa_cli_cmds.c b/wpa_supplicant/wpa_cli_cmds.c index abecced0f..80ab86a0d 100644 --- a/wpa_supplicant/wpa_cli_cmds.c +++ b/wpa_supplicant/wpa_cli_cmds.c @@ -2491,7 +2491,7 @@ static int wpa_cli_cmd_tdls_link_status(struct wpa_ctrl *ctrl, int argc, return wpa_cli_cmd(ctrl, "TDLS_LINK_STATUS", 1, argc, argv); } - +#ifdef CONFIG_WMM_AC static int wpa_cli_cmd_wmm_ac_addts(struct wpa_ctrl *ctrl, int argc, char *argv[]) { @@ -2511,7 +2511,7 @@ static int wpa_cli_cmd_wmm_ac_status(struct wpa_ctrl *ctrl, int argc, { return wpa_ctrl_command(ctrl, "WMM_AC_STATUS"); } - +#endif /* CONFIG_WMM_AC */ static int wpa_cli_cmd_tdls_chan_switch(struct wpa_ctrl *ctrl, int argc, char *argv[]) @@ -2952,7 +2952,7 @@ struct wpa_cli_cmd { static const struct wpa_cli_cmd wpa_cli_commands[] = { { "status", wpa_cli_cmd_status, NULL, cli_cmd_flag_none, - "[verbose] = get current WPA/EAPOL/EAP status" }, + "[verbose] = get current WPA/EAPOL/EAP status" }, { "set_network", wpa_cli_cmd_set_network, wpa_cli_complete_network, cli_cmd_flag_sensitive, " = set network variables (shows\n" @@ -3693,4 +3693,4 @@ int wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[]) } return ret; -} \ No newline at end of file +} diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 4a18c043f..4d0a5c16f 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -582,7 +582,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) wpa_tdls_deinit(wpa_s->wpa); #endif /* CONFIG_TDLS */ +#ifdef CONFIG_WMM_AC wmm_ac_clear_saved_tspecs(wpa_s); +#endif /* CONFIG_WMM_AC */ pmksa_candidate_free(wpa_s->wpa); ptksa_cache_deinit(wpa_s->ptksa); wpa_s->ptksa = NULL; @@ -698,9 +700,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) wpabuf_free(wpa_s->vendor_elem[i]); wpa_s->vendor_elem[i] = NULL; } - +#ifdef CONFIG_WMM_AC wmm_ac_notify_disassoc(wpa_s); - +#endif /* CONFIG_WMM_AC */ wpa_s->sched_scan_plans_num = 0; os_free(wpa_s->sched_scan_plans); wpa_s->sched_scan_plans = NULL; @@ -715,7 +717,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) wpabuf_free(wpa_s->lci); wpa_s->lci = NULL; +#ifdef CONFIG_RRM wpas_clear_beacon_rep_data(wpa_s); +#endif /* CONFIG_RRM */ #ifdef CONFIG_PMKSA_CACHE_EXTERNAL #ifdef CONFIG_MESH @@ -747,8 +751,10 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) #ifdef CONFIG_PASN wpas_pasn_auth_stop(wpa_s); #endif /* CONFIG_PASN */ +#ifdef CONFIG_ROBUST_AV wpas_scs_deinit(wpa_s); wpas_dscp_deinit(wpa_s); +#endif /* CONFIG_ROBUST_AV */ } @@ -1077,9 +1083,10 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, if (state == WPA_DISCONNECTED || state == WPA_INACTIVE) wpa_supplicant_start_autoscan(wpa_s); +#ifdef CONFIG_WMM_AC if (old_state >= WPA_ASSOCIATED && wpa_s->wpa_state < WPA_ASSOCIATED) wmm_ac_notify_disassoc(wpa_s); - +#endif /* CONFIG_WMM_AC */ if (wpa_s->wpa_state != old_state) { wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state); @@ -2256,7 +2263,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, rand_style = ssid->mac_addr; wpa_s->multi_ap_ie = 0; +#ifdef CONFIG_WMM_AC wmm_ac_clear_saved_tspecs(wpa_s); +#endif /* CONFIG_WMM_AC */ wpa_s->reassoc_same_bss = 0; wpa_s->reassoc_same_ess = 0; #ifdef CONFIG_TESTING_OPTIONS @@ -2267,7 +2276,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Re-association to the same ESS"); wpa_s->reassoc_same_ess = 1; if (wpa_s->current_bss && wpa_s->current_bss == bss) { +#ifdef CONFIG_WMM_AC wmm_ac_save_tspecs(wpa_s); +#endif /* CONFIG_WMM_AC */ wpa_s->reassoc_same_bss = 1; } else if (wpa_s->current_bss && wpa_s->current_bss != bss) { os_get_reltime(&wpa_s->roam_start); @@ -2900,8 +2911,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)); +#ifdef CONFIG_ROBUST_AV if (wpa_s->enable_dscp_policy_capa) wfa_capa[0] |= WFA_CAPA_QM_DSCP_POLICY; +#endif /* CONFIG_ROBUST_AV */ if (!wfa_capa[0]) return wpa_ie_len; @@ -3152,13 +3165,14 @@ static u8 * wpas_populate_assoc_ies( os_memset(wpa_s->p2p_ip_addr_info, 0, sizeof(wpa_s->p2p_ip_addr_info)); #endif /* CONFIG_P2P */ +#ifdef CONFIG_RRM if (bss) { wpa_ie_len += wpas_supp_op_class_ie(wpa_s, ssid, bss, wpa_ie + wpa_ie_len, max_wpa_ie_len - wpa_ie_len); } - +#endif /* CONFIG_RRM */ /* * Workaround: Add Extended Capabilities element only if the AP * included this element in Beacon/Probe Response frames. Some older @@ -3384,6 +3398,7 @@ static u8 * wpas_populate_assoc_ies( if (wpa_s->disable_mscs_support) goto mscs_end; #endif /* CONFIG_TESTING_OPTIONS */ +#ifdef CONFIG_RRM if (wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_MSCS) && wpa_s->robust_av.valid_config) { struct wpabuf *mscs_ie; @@ -3414,7 +3429,7 @@ static u8 * wpas_populate_assoc_ies( wpabuf_free(mscs_ie); } mscs_end: - +#endif /* CONFIG_RRM */ wpa_ie_len = wpas_populate_wfa_capa(wpa_s, bss, wpa_ie, wpa_ie_len, max_wpa_ie_len); @@ -3688,7 +3703,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; +#ifdef CONFIG_ROBUST_AV wpa_s->mscs_setup_done = false; +#endif /* CONFIG_ROBUST_AV */ wpa_ie = wpas_populate_assoc_ies(wpa_s, bss, ssid, ¶ms, NULL); if (!wpa_ie) { @@ -4127,8 +4144,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); +#ifdef CONFIG_ROBUST_AV wpas_scs_deinit(wpa_s); wpas_dscp_deinit(wpa_s); +#endif /* CONFIG_ROBUST_AV */ eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); } @@ -5403,7 +5422,9 @@ wpa_supplicant_alloc(struct wpa_supplicant *parent) #ifdef CONFIG_TESTING_OPTIONS dl_list_init(&wpa_s->drv_signal_override); #endif /* CONFIG_TESTING_OPTIONS */ +#ifdef CONFIG_ROBUST_AV dl_list_init(&wpa_s->active_scs_ids); +#endif /* CONFIG_ROBUST_AV */ return wpa_s; } @@ -6753,7 +6774,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->extended_capa_len = capa.extended_capa_len; wpa_s->num_multichan_concurrent = capa.num_multichan_concurrent; +#ifdef CONFIG_WMM_AC wpa_s->wmm_ac_supported = capa.wmm_ac_supported; +#endif /* CONFIG_WMM_AC */ if (capa.mac_addr_rand_scan_supported) wpa_s->mac_addr_rand_supported |= MAC_ADDR_RAND_SCAN; @@ -6903,7 +6926,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, if (wpas_init_ext_pw(wpa_s) < 0) return -1; +#ifdef CONFIG_RRM wpas_rrm_reset(wpa_s); +#endif /* CONFIG_RRM */ wpas_sched_scan_plans_set(wpa_s, wpa_s->conf->sched_scan_plans); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index e79cd6260..da69173ea 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1507,19 +1507,11 @@ struct wpa_supplicant { unsigned int multi_ap_ie:1; unsigned int multi_ap_backhaul:1; unsigned int multi_ap_fronthaul:1; +#ifdef CONFIG_RRM struct robust_av_data robust_av; bool mscs_setup_done; - -#ifdef CONFIG_PASN - struct wpas_pasn pasn; - struct wpa_radio_work *pasn_auth_work; -#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; @@ -1527,6 +1519,15 @@ struct wpa_supplicant { unsigned int enable_dscp_policy_capa:1; unsigned int connection_dscp:1; unsigned int wait_for_dscp_req:1; +#endif /* CONFIG_RRM */ +#ifdef CONFIG_PASN + struct wpas_pasn pasn; + struct wpa_radio_work *pasn_auth_work; +#endif /* CONFIG_PASN */ +#ifdef CONFIG_TESTING_OPTIONS + unsigned int disable_scs_support:1; + unsigned int disable_mscs_support:1; +#endif /* CONFIG_TESTING_OPTIONS */ }; @@ -1655,7 +1656,7 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, bool flow_type, u8 flow_id, bool protection, u8 twt_channel, u8 control); int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags); - +#ifdef CONFIG_RRM void wpas_rrm_reset(struct wpa_supplicant *wpa_s); void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s, const u8 *report, size_t report_len); @@ -1673,6 +1674,7 @@ void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s, const u8 *frame, size_t len, int rssi); void wpas_rrm_refuse_request(struct wpa_supplicant *wpa_s); +#endif /* CONFIG_RRM */ int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res, struct scan_info *info);