]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OCE: Add OCE capability attribute only when associating to an OCE AP
authorBeni Lev <beni.lev@intel.com>
Sun, 26 Aug 2018 17:45:04 +0000 (20:45 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 2 Sep 2018 15:16:30 +0000 (18:16 +0300)
Signed-off-by: Beni Lev <beni.lev@intel.com>
wpa_supplicant/mbo.c
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 129d205451bb3a92ab59807bdc4f23c3237fd1c6..5adf61e58bd0b4e1e32f505f45d99cd7267f06a3 100644 (file)
@@ -38,6 +38,19 @@ static int wpas_mbo_validate_non_pref_chan(u8 oper_class, u8 chan, u8 reason)
 }
 
 
+const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr)
+{
+       const u8 *mbo;
+       u8 ie_len = mbo_ie[1];
+
+       if (ie_len < MBO_IE_HEADER - 2)
+               return NULL;
+       mbo = mbo_ie + MBO_IE_HEADER;
+
+       return get_ie(mbo, 2 + ie_len - MBO_IE_HEADER, attr);
+}
+
+
 const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr)
 {
        const u8 *mbo, *end;
@@ -149,7 +162,8 @@ static void wpas_mbo_non_pref_chan_attrs(struct wpa_supplicant *wpa_s,
 }
 
 
-int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len)
+int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len,
+               int add_oce_capa)
 {
        struct wpabuf *mbo;
        int res;
@@ -175,7 +189,7 @@ int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len)
        wpabuf_put_u8(mbo, wpa_s->conf->mbo_cell_capa);
 
        /* Add OCE capability indication attribute if OCE is enabled */
-       if (wpa_s->enable_oce & OCE_STA) {
+       if ((wpa_s->enable_oce & OCE_STA) && add_oce_capa) {
                wpabuf_put_u8(mbo, OCE_ATTR_ID_CAPA_IND);
                wpabuf_put_u8(mbo, 1);
                wpabuf_put_u8(mbo, OCE_RELEASE);
index b685064746d8b7c80ec5df5c7756f6e590ca1794..708a347a8332f35f76daf5f3e326907ca7ab0ece 100644 (file)
@@ -240,6 +240,9 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
        u8 ext_capab[18];
        int ext_capab_len;
        int skip_auth;
+#ifdef CONFIG_MBO
+       const u8 *mbo_ie;
+#endif /* CONFIG_MBO */
 
        if (bss == NULL) {
                wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for "
@@ -539,13 +542,16 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
        }
 
 #ifdef CONFIG_MBO
-       if (wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE)) {
+       mbo_ie = wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE);
+       if (mbo_ie) {
                int len;
 
                len = wpas_mbo_ie(wpa_s, wpa_s->sme.assoc_req_ie +
                                  wpa_s->sme.assoc_req_ie_len,
                                  sizeof(wpa_s->sme.assoc_req_ie) -
-                                 wpa_s->sme.assoc_req_ie_len);
+                                 wpa_s->sme.assoc_req_ie_len,
+                                 !!mbo_attr_from_mbo_ie(mbo_ie,
+                                                        OCE_ATTR_ID_CAPA_IND));
                if (len >= 0)
                        wpa_s->sme.assoc_req_ie_len += len;
        }
index 8bd27274f3ff6070970df92661f86ae2906667aa..2180238321d8dba42fe5ad0e995cb35ff0ef6fad 100644 (file)
@@ -2444,6 +2444,9 @@ static u8 * wpas_populate_assoc_ies(
        size_t max_wpa_ie_len = 500;
        size_t wpa_ie_len;
        int algs = WPA_AUTH_ALG_OPEN;
+#ifdef CONFIG_MBO
+       const u8 *mbo_ie;
+#endif
 #ifdef CONFIG_FILS
        const u8 *realm, *username, *rrk;
        size_t realm_len, username_len, rrk_len;
@@ -2699,11 +2702,14 @@ static u8 * wpas_populate_assoc_ies(
 #endif /* CONFIG_FST */
 
 #ifdef CONFIG_MBO
-       if (bss && wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE)) {
+       mbo_ie = bss ? wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE) : NULL;
+       if (mbo_ie) {
                int len;
 
                len = wpas_mbo_ie(wpa_s, wpa_ie + wpa_ie_len,
-                                 max_wpa_ie_len - wpa_ie_len);
+                                 max_wpa_ie_len - wpa_ie_len,
+                                 !!mbo_attr_from_mbo_ie(mbo_ie,
+                                                        OCE_ATTR_ID_CAPA_IND));
                if (len >= 0)
                        wpa_ie_len += len;
        }
index c6d6d84d84d60e8c5dde73e8580c4668a490a575..9b8d1fa1effe5acfe054777f6f18b09e895d74cd 100644 (file)
@@ -1359,7 +1359,9 @@ void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
 
 
 /* MBO functions */
-int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
+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);
 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
                                  const char *non_pref_chan);