]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MBO: Check association disallowed in Beacon frames, if newer
authorKuan-Chung Chen <damon.chen@realtek.com>
Fri, 28 Jan 2022 09:25:46 +0000 (17:25 +0800)
committerJouni Malinen <j@w1.fi>
Sun, 24 Apr 2022 09:12:21 +0000 (12:12 +0300)
When a station receives either a Beacon frame or a Probe Response frame
from an AP that contains an MBO element with the Association Disallowed
attribute, the station should prevent association to that AP. When using
passive scanning, it is possible for the scan results to contain the
latest information in the Beacon frame elements instead of the Probe
Response frame elements. That could result in using old information and
not noticing the AP having changed its state to disallowing new
associations.

Make it more likely to follow the AP's change to disallow associations
by checking the Beacon frame elements instead of Probe Response frame
elements if the scan results are known to contain newer information for
the Beacon frame.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
wpa_supplicant/events.c
wpa_supplicant/mbo.c
wpa_supplicant/wpa_supplicant_i.h

index a977bca76a1db9db2a80506daf7a7c473a3feae0..81f4a5f43b45a8a98d4d0510b2502abfeb82ce03 100644 (file)
@@ -1454,7 +1454,7 @@ static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
        if (wpa_s->ignore_assoc_disallow)
                goto skip_assoc_disallow;
 #endif /* CONFIG_TESTING_OPTIONS */
-       assoc_disallow = wpas_mbo_get_bss_attr(bss, MBO_ATTR_ID_ASSOC_DISALLOW);
+       assoc_disallow = wpas_mbo_check_assoc_disallow(bss);
        if (assoc_disallow && assoc_disallow[1] >= 1) {
                if (debug_print)
                        wpa_dbg(wpa_s, MSG_DEBUG,
index 3df86ef0724e0f7a10699c85f4246fe1e6b3fa47..59b15daf6dfd492393d04d74f7107699bf7cd3de 100644 (file)
@@ -65,14 +65,18 @@ const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len,
 }
 
 
-const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr)
+static const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss,
+                                       enum mbo_attr_id attr, bool beacon)
 {
        const u8 *mbo, *end;
 
        if (!bss)
                return NULL;
 
-       mbo = wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE);
+       if (beacon)
+               mbo = wpa_bss_get_vendor_ie_beacon(bss, MBO_IE_VENDOR_TYPE);
+       else
+               mbo = wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE);
        if (!mbo)
                return NULL;
 
@@ -83,6 +87,19 @@ const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr)
 }
 
 
+const u8 * wpas_mbo_check_assoc_disallow(struct wpa_bss *bss)
+{
+       const u8 *assoc_disallow;
+
+       assoc_disallow = wpas_mbo_get_bss_attr(bss, MBO_ATTR_ID_ASSOC_DISALLOW,
+                                              bss->beacon_newer);
+       if (assoc_disallow && assoc_disallow[1] >= 1)
+               return assoc_disallow;
+
+       return NULL;
+}
+
+
 void wpas_mbo_check_pmf(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
                        struct wpa_ssid *ssid)
 {
@@ -92,8 +109,8 @@ void wpas_mbo_check_pmf(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
        wpa_s->disable_mbo_oce = 0;
        if (!bss)
                return;
-       mbo = wpas_mbo_get_bss_attr(bss, MBO_ATTR_ID_AP_CAPA_IND);
-       oce = wpas_mbo_get_bss_attr(bss, OCE_ATTR_ID_CAPA_IND);
+       mbo = wpas_mbo_get_bss_attr(bss, MBO_ATTR_ID_AP_CAPA_IND, false);
+       oce = wpas_mbo_get_bss_attr(bss, OCE_ATTR_ID_CAPA_IND, false);
        if (!mbo && !oce)
                return;
        if (oce && oce[1] >= 1 && (oce[2] & OCE_IS_STA_CFON))
index da3c36166a30f8c7f14771ee68b8384ea4bf72a6..0ba352fcb20fb1972f37e64a4b36dace115634cf 100644 (file)
@@ -1686,7 +1686,7 @@ void wpa_supplicant_reset_bgscan(struct wpa_supplicant *wpa_s);
 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len,
                int add_oce_capa);
 const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr);
-const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
+const u8 * wpas_mbo_check_assoc_disallow(struct wpa_bss *bss);
 void wpas_mbo_check_pmf(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
                        struct wpa_ssid *ssid);
 const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len,