]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OWE: Optimize transition mode scan to use known channels
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 8 Nov 2023 12:19:03 +0000 (14:19 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 8 Nov 2023 12:21:40 +0000 (14:21 +0200)
If the currently available scan results include OWE transition mode BSS
with an unknown SSID, optimize the following scan for OWE to use only
the channels on which a known transition mode BSS has been seen.

This is needed to be able to remove the design that updates BSS entries
with the learned OWE SSID in manner that does not result in regression
to scanning latencies.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index ff9b5b50b17494b9679799c557b869296223bf5f..d4167674725c3c9bbfa287faab74823e57497757 100644 (file)
@@ -1600,6 +1600,22 @@ skip_assoc_disallow:
 #endif /* CONFIG_SAE_PK */
 
        if (bss->ssid_len == 0) {
+#ifdef CONFIG_OWE
+               const u8 *owe_ssid = NULL;
+               size_t owe_ssid_len = 0;
+
+               owe_trans_ssid(wpa_s, bss, &owe_ssid, &owe_ssid_len);
+               if (owe_ssid && owe_ssid_len &&
+                   owe_ssid_len == ssid->ssid_len &&
+                   os_memcmp(owe_ssid, ssid->ssid, owe_ssid_len) == 0) {
+                       if (debug_print)
+                               wpa_dbg(wpa_s, MSG_DEBUG,
+                                       "   skip - no SSID in BSS entry for a possible OWE transition mode BSS");
+                       int_array_add_unique(&wpa_s->owe_trans_scan_freq,
+                                            bss->freq);
+                       return false;
+               }
+#endif /* CONFIG_OWE */
                if (debug_print)
                        wpa_dbg(wpa_s, MSG_DEBUG,
                                "   skip - no SSID known for the BSS");
@@ -2556,6 +2572,10 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
                return 0; /* no normal connection on p2p_mgmt interface */
 
        wpa_s->owe_transition_search = 0;
+#ifdef CONFIG_OWE
+       os_free(wpa_s->owe_trans_scan_freq);
+       wpa_s->owe_trans_scan_freq = NULL;
+#endif /* CONFIG_OWE */
        selected = wpa_supplicant_pick_network(wpa_s, &ssid);
 
 #ifdef CONFIG_MESH
@@ -2675,6 +2695,13 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
                                        "OWE: Use shorter wait during transition mode search");
                                timeout_sec = 0;
                                timeout_usec = 500000;
+                               if (wpa_s->owe_trans_scan_freq) {
+                                       os_free(wpa_s->next_scan_freqs);
+                                       wpa_s->next_scan_freqs =
+                                               wpa_s->owe_trans_scan_freq;
+                                       wpa_s->owe_trans_scan_freq = NULL;
+                                       timeout_usec = 100000;
+                               }
                                wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
                                                            timeout_usec);
                                return 0;
index 48f9bc5066fe9c74433be37d0a778299f75e2aeb..972f54fcb20082f2ce5c35fa82967f7e01a17815 100644 (file)
@@ -749,6 +749,11 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
 #endif /* CONFIG_PASN */
        wpas_scs_deinit(wpa_s);
        wpas_dscp_deinit(wpa_s);
+
+#ifdef CONFIG_OWE
+       os_free(wpa_s->owe_trans_scan_freq);
+       wpa_s->owe_trans_scan_freq = NULL;
+#endif /* CONFIG_OWE */
 }
 
 
index d3bd5e19616b5d165a00d70d341ab07061e64d75..c3c766bbf903699af3270bfa051f92465336b515 100644 (file)
@@ -1576,6 +1576,12 @@ struct wpa_supplicant {
 
        struct wpa_ssid *ml_connect_probe_ssid;
        struct wpa_bss *ml_connect_probe_bss;
+
+#ifdef CONFIG_OWE
+       /* An array of frequencies to scan for OWE transition mode BSSs when
+        * owe_transition_search == 1 */
+       int *owe_trans_scan_freq;
+#endif /* CONFIG_OWE */
 };