diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index e9c2f822c..64fd4b843 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1390,6 +1390,8 @@ const u8 * wpa_bss_get_fils_cache_id(const struct wpa_bss *bss) int wpa_bss_ext_capab(const struct wpa_bss *bss, unsigned int capab) { + if (!bss) + return 0; return ieee802_11_ext_capab(wpa_bss_get_ie(bss, WLAN_EID_EXT_CAPAB), capab); } diff --git a/wpa_supplicant/robust_av.c b/wpa_supplicant/robust_av.c index 7ecd35769..f6da56eed 100644 --- a/wpa_supplicant/robust_av.c +++ b/wpa_supplicant/robust_av.c @@ -54,8 +54,7 @@ int wpas_send_mscs_req(struct wpa_supplicant *wpa_s) if (wpa_s->wpa_state != WPA_COMPLETED || !wpa_s->current_ssid) return 0; - if (!wpa_s->current_bss || - !wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) { + if (!wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) { wpa_dbg(wpa_s, MSG_INFO, "AP does not support MSCS - could not send MSCS Req"); return -1; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 46963e92f..c6cef5b14 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1881,13 +1881,11 @@ pfs_fail: #endif /* CONFIG_DPP2 */ wpa_s->mscs_setup_done = false; - if (wpa_s->current_bss && wpa_s->robust_av.valid_config) { + if (wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS) && + wpa_s->robust_av.valid_config) { struct wpabuf *mscs_ie; size_t mscs_ie_len, buf_len, *wpa_ie_len, max_ie_len; - if (!wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) - goto mscs_fail; - buf_len = 3 + /* MSCS descriptor IE header */ 1 + /* Request type */ 2 + /* User priority control */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 281fe11be..216933f23 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3204,13 +3204,11 @@ pfs_fail: wpa_ie_len += wpa_s->rsnxe_len; } - if (bss && wpa_s->robust_av.valid_config) { + if (wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_MSCS) && + wpa_s->robust_av.valid_config) { struct wpabuf *mscs_ie; size_t mscs_ie_len, buf_len; - if (!wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_MSCS)) - goto mscs_fail; - buf_len = 3 + /* MSCS descriptor IE header */ 1 + /* Request type */ 2 + /* User priority control */