]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OWE: Consider the currently associated transition mode SSID known
authorBen Lai <ben.lai@mediatek.com>
Fri, 27 Dec 2024 06:13:38 +0000 (14:13 +0800)
committerJouni Malinen <j@w1.fi>
Tue, 21 Jan 2025 17:44:21 +0000 (19:44 +0200)
When the BSS table size limit is reached the oldest unknown BSS entry is
removed when needing to add a new BSS. This could have resulted in use
of freed memory before wpa_bss_remove_oldest_unknown() was extended to
use wpa_bss_in_use() as a condition for removing a BSS entry. Even with
that issue addressed, it is better to recognize BSS entries that match
the current network profiles SSID in cases where that match is through
the OWE transition mode mechanism. This avoids removing entries that
might be used finding a better BSS.

Signed-off-by: Sunil Ravi <sunilravi@google.com>
wpa_supplicant/bss.c

index 445e6cd6197adc8386f4a75899f212afd9467a02..7cda7d5e1ed291bd0c8ff8fa42729c7fffeea85c 100644 (file)
@@ -423,6 +423,28 @@ static bool is_p2p_pending_bss(struct wpa_supplicant *wpa_s,
 }
 
 
+#ifdef CONFIG_OWE
+static int wpa_bss_owe_trans_known(struct wpa_supplicant *wpa_s,
+                                  struct wpa_bss *bss,
+                                  const u8 *entry_ssid, size_t entry_ssid_len)
+{
+       const u8 *owe, *owe_bssid, *owe_ssid;
+       size_t owe_ssid_len;
+
+       owe = wpa_bss_get_vendor_ie(bss, OWE_IE_VENDOR_TYPE);
+       if (!owe)
+               return 0;
+
+       if (wpas_get_owe_trans_network(owe, &owe_bssid, &owe_ssid,
+                                      &owe_ssid_len))
+               return 0;
+
+       return entry_ssid_len == owe_ssid_len &&
+               os_memcmp(owe_ssid, entry_ssid, owe_ssid_len) == 0;
+}
+#endif /* CONFIG_OWE */
+
+
 static int wpa_bss_known(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 {
        struct wpa_ssid *ssid;
@@ -436,6 +458,11 @@ static int wpa_bss_known(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
                if (ssid->ssid_len == bss->ssid_len &&
                    os_memcmp(ssid->ssid, bss->ssid, ssid->ssid_len) == 0)
                        return 1;
+#ifdef CONFIG_OWE
+               if (wpa_bss_owe_trans_known(wpa_s, bss, ssid->ssid,
+                                           ssid->ssid_len))
+                       return 1;
+#endif /* CONFIG_OWE */
        }
 
        return 0;