[PATCH v2 5/5] scan: stored last-seen transition SSID

David Bauer mail at david-bauer.net
Sun Apr 28 06:13:44 PDT 2024


Store the last seen transition SSID when conneted to an OWE network
enabling transition-mode.

This speeds up discovery of hidden transition networks when connected on
6GHz. As 6 GHz does not use inter-band transition mode operation,
the transition SSID name is missing from beacons on this band.

When the scan-list times out, wpa_supplicant has to scan two consecutive
times to first discover transition networks on 2.4 and 5GHz.

Optimize this by storing the last transition-SSID independent from the
scan-results.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 wpa_supplicant/bss.c              | 34 ++++++++++++++++++++++++++-----
 wpa_supplicant/events.c           |  4 ++++
 wpa_supplicant/scan.c             | 12 +++++++++++
 wpa_supplicant/wpa_supplicant_i.h |  2 ++
 4 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index b9bf06c45..7357e092e 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -909,7 +909,7 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
 			     struct wpa_scan_res *res,
 			     struct os_reltime *fetch_time)
 {
-	const u8 *ssid, *p2p, *mesh, *owe, *rsn;
+	const u8 *ssid, *p2p, *mesh, *owe;
 	struct wpa_bss *bss;
 
 	if (wpa_s->conf->ignore_old_scan_res) {
@@ -940,11 +940,35 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
 		return;
 	}
 
-	/* Don't add hidden OWE transition networks with RSN. They are explicitly scanned for. */
-	rsn = wpa_scan_get_ie(res, WLAN_EID_RSN);
 	owe = wpa_scan_get_vendor_ie(res, OWE_IE_VENDOR_TYPE);
-	if (owe && rsn && (ssid[1] == 0 || ssid[2] == 0))
-		return;
+	if (owe) {
+		const uint8_t *rsn;
+
+		rsn = wpa_scan_get_ie(res, WLAN_EID_RSN);
+
+		/**
+		 * Don't add hidden OWE transition networks with RSN.
+		 * They are explicitly scanned for.
+		 */
+		if (rsn && (ssid[1] == 0 || ssid[2] == 0))
+			return;
+#ifdef CONFIG_OWE
+		const uint8_t *owe_bssid, *owe_ssid;
+		size_t owe_ssid_len;
+
+		/**
+		 * If the network is an OWE transition network, store the transition SSID
+		 * to allow scanning for it later when on a 6GHz network with expired
+		 * scan results.
+		 */
+		if (!rsn &&
+		    !wpa_bss_get_owe_trans_network(wpa_s, owe, &owe_bssid,
+						   &owe_ssid, &owe_ssid_len)) {
+			os_memcpy(wpa_s->owe_trans_ssid.ssid, owe_ssid, owe_ssid_len);
+			wpa_s->owe_trans_ssid.ssid_len = owe_ssid_len;
+		}
+#endif /* CONFIG_OWE */
+	}
 
 	p2p = wpa_scan_get_vendor_ie(res, P2P_IE_VENDOR_TYPE);
 #ifdef CONFIG_P2P
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index abeaefff1..e20eae549 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -383,6 +383,10 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
 	wpa_s->key_mgmt = 0;
 	wpa_s->allowed_key_mgmts = 0;
 
+#ifdef CONFIG_OWE
+	wpa_s->owe_trans_ssid.ssid_len = 0;
+#endif
+
 #ifndef CONFIG_NO_RRM
 	wpas_rrm_reset(wpa_s);
 #endif /* CONFIG_NO_RRM */
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 8a0387301..d9a7c9e10 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -976,6 +976,18 @@ void wpa_add_owe_scan_ssid(struct wpa_supplicant *wpa_s,
 				  owe_ssid, owe_ssid_len);
 		return;
 	}
+
+	/**
+	 * Check if we can add a stored transition-mode SSID.
+	 * This is helpful if the scan-list only contains 6 GHz networks
+	 * which do not have a transition SSID.
+	 */
+	if (wpa_s->owe_trans_ssid.ssid_len == 0)
+		return;
+
+	wpa_add_scan_ssid(wpa_s, params, max_ssids,
+			  wpa_s->owe_trans_ssid.ssid,
+			  wpa_s->owe_trans_ssid.ssid_len);
 #endif /* CONFIG_OWE */
 }
 
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 426d077d2..c785f0d04 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1602,6 +1602,8 @@ struct wpa_supplicant {
 	/* An array of frequencies to scan for OWE transition mode BSSs when
 	 * owe_transition_search == 1 */
 	int *owe_trans_scan_freq;
+	/* The last transition-SSID seen if operating in transition-mode */
+	struct wpa_ssid_value owe_trans_ssid;
 #endif /* CONFIG_OWE */
 
 #ifdef CONFIG_NAN_USD
-- 
2.43.0




More information about the Hostap mailing list