Make wpa_bss_ext_capab() handle NULL bss argument

This simplifies the callers that use wpa_s->current_bss (which could be
NULL).

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2021-02-06 11:00:09 +02:00
parent 2cadb60abd
commit 8f557d2047
4 changed files with 7 additions and 10 deletions

View file

@ -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) 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), return ieee802_11_ext_capab(wpa_bss_get_ie(bss, WLAN_EID_EXT_CAPAB),
capab); capab);
} }

View file

@ -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) if (wpa_s->wpa_state != WPA_COMPLETED || !wpa_s->current_ssid)
return 0; return 0;
if (!wpa_s->current_bss || if (!wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) {
!wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS)) {
wpa_dbg(wpa_s, MSG_INFO, wpa_dbg(wpa_s, MSG_INFO,
"AP does not support MSCS - could not send MSCS Req"); "AP does not support MSCS - could not send MSCS Req");
return -1; return -1;

View file

@ -1881,13 +1881,11 @@ pfs_fail:
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */
wpa_s->mscs_setup_done = false; 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; struct wpabuf *mscs_ie;
size_t mscs_ie_len, buf_len, *wpa_ie_len, max_ie_len; 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 */ buf_len = 3 + /* MSCS descriptor IE header */
1 + /* Request type */ 1 + /* Request type */
2 + /* User priority control */ 2 + /* User priority control */

View file

@ -3204,13 +3204,11 @@ pfs_fail:
wpa_ie_len += wpa_s->rsnxe_len; 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; struct wpabuf *mscs_ie;
size_t mscs_ie_len, buf_len; 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 */ buf_len = 3 + /* MSCS descriptor IE header */
1 + /* Request type */ 1 + /* Request type */
2 + /* User priority control */ 2 + /* User priority control */