]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Clean up hostapd_get_he_twt_responder() processing
authorJouni Malinen <j@w1.fi>
Sun, 8 Mar 2020 14:28:03 +0000 (16:28 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 8 Mar 2020 14:28:03 +0000 (16:28 +0200)
mode->he_capab is an array and as such, there is no point in checking
whether it is NULL since that cannot be the case. Check for the
he_supported flag instead. In addition, convert the TWT responder
capability bit into a fixed value 1 to avoid any surprising to the
callers. In practice, neither of these changes results in different
behavior in the current implementation, but this is more robust.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/ieee802_11_he.c

index 4b23e48c7bc81594e394491a359077372d824ee4..57c6b18f4bf89c1e4362b0e0a05678486d21627b 100644 (file)
@@ -421,10 +421,10 @@ int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
        u8 *mac_cap;
 
        if (!hapd->iface->current_mode ||
-           !hapd->iface->current_mode->he_capab)
+           !hapd->iface->current_mode->he_capab[mode].he_supported)
                return 0;
 
        mac_cap = hapd->iface->current_mode->he_capab[mode].mac_cap;
 
-       return mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER;
+       return !!(mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER);
 }