MBO: Prevent association to APs that explicitly disallow this
authorDavid Spinadel <david.spinadel@intel.com>
Mon, 15 Feb 2016 14:53:29 +0000 (16:53 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Feb 2016 17:53:04 +0000 (19:53 +0200)
Prevent association to MBO APs that have association disallowed
attribute in MBO IE in Beacon or Probe Response frames.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
wpa_supplicant/events.c
wpa_supplicant/mbo.c
wpa_supplicant/wpa_supplicant_i.h

index 3264dc0..76835de 100644 (file)
@@ -827,6 +827,9 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
        const u8 *ie;
        struct wpa_ssid *ssid;
        int osen;
+#ifdef CONFIG_MBO
+       const u8 *assoc_disallow;
+#endif /* CONFIG_MBO */
 
        ie = wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
        wpa_ie_len = ie ? ie[1] : 0;
@@ -1064,6 +1067,16 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
                                (unsigned int) diff.usec);
                        continue;
                }
+#ifdef CONFIG_MBO
+               assoc_disallow = wpas_mbo_get_bss_attr(
+                       bss, MBO_ATTR_ID_ASSOC_DISALLOW);
+               if (assoc_disallow && assoc_disallow[1] >= 1) {
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "   skip - MBO association disallowed (reason %u)",
+                               assoc_disallow[2]);
+                       continue;
+               }
+#endif /* CONFIG_MBO */
 
                /* Matching configuration found */
                return ssid;
index d6f2e76..a60d1d3 100644 (file)
@@ -36,6 +36,24 @@ static int wpas_mbo_validate_non_pref_chan(u8 oper_class, u8 chan, u8 reason)
 }
 
 
+const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr)
+{
+       const u8 *mbo, *end;
+
+       if (!bss)
+               return NULL;
+
+       mbo = wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE);
+       if (!mbo)
+               return NULL;
+
+       end = mbo + 2 + mbo[1];
+       mbo += MBO_IE_HEADER;
+
+       return get_ie(mbo, end - mbo, attr);
+}
+
+
 static void wpas_mbo_non_pref_chan_attr_body(struct wpa_supplicant *wpa_s,
                                             struct wpabuf *mbo,
                                             u8 start, u8 end)
index d53bc96..1a29737 100644 (file)
@@ -1144,6 +1144,7 @@ void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
 
 /* MBO functions */
 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
+const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
                                  const char *non_pref_chan);
 void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);