[PATCH 4/4] WNM: Extend the discovery of the 6 GHz candidates
Benjamin Berg
benjamin at sipsolutions.net
Mon Aug 4 07:39:22 PDT 2025
From: Ilan Peer <ilan.peer at intel.com>
Candidates on 6 GHz channels might be collocated ones, and thus, in
order to discover them need to include the frequencies on the 2/5 GHz
bands.
Extend the WNM scan frequency channels to include the 2/5 GHz channels
in case the WNM neighbor list included candidates on the 6 GHz band.
Since such a scan can be long, optimize the case of a single channel
and instead force passive scanning.
In addition, in case the candidate validity interval is too short,
ignore the validity interval, and set it to 5 seconds, as we are
increasing the discovery time so results might not be valid once
we get them.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
wpa_supplicant/wnm_sta.c | 66 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index 4eac401227..88838b554b 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -1226,6 +1226,7 @@ static int chan_supported(struct wpa_supplicant *wpa_s, int freq)
static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
{
unsigned int i;
+ u8 has_6ghz = 0;
if (!wpa_s->wnm_neighbor_report_elements)
return;
@@ -1256,6 +1257,7 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
if (chan_supported(wpa_s, nei->freq))
int_array_add_unique(&wpa_s->next_scan_freqs,
nei->freq);
+ has_6ghz |= is_6ghz_freq(nei->freq);
}
if (!wpa_s->next_scan_freqs)
@@ -1264,6 +1266,70 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
wpa_printf(MSG_DEBUG,
"WNM: Scan %zd frequencies based on transition candidate list",
int_array_len(wpa_s->next_scan_freqs));
+
+ /*
+ * Candidates on 6GHz channels might be collocated ones, and thus, in
+ * order to discover them need to include the frequencies on the 2/5 GHz
+ * bands. Since the scan time can be long, optimize the case of a single
+ * channel by forcing passive scan instead of doing a collocated scan.
+ */
+ if (has_6ghz) {
+ struct hostapd_channel_data *chan;
+ struct os_reltime now;
+ unsigned int i;
+
+ /* In case the candidate validity time is too short, force it
+ * to be long enough to account for the longer scan time.
+ */
+ os_get_reltime(&now);
+ now.sec += 5;
+
+ if (os_reltime_initialized(&wpa_s->wnm_cand_valid_until) &&
+ !os_reltime_before(&wpa_s->wnm_cand_valid_until, &now)) {
+ wpa_printf(MSG_DEBUG,
+ "WNM: scan: 6GHz: update validity time");
+
+ os_memcpy(&wpa_s->wnm_cand_valid_until, &now,
+ sizeof(now));
+ }
+
+ if (int_array_len(wpa_s->next_scan_freqs) == 1) {
+ wpa_printf(MSG_DEBUG,
+ "WNM: scan: single 6GHz channel: passive");
+
+ wpa_s->scan_req = MANUAL_SCAN_REQ;
+ wpa_s->manual_scan_passive = 1;
+ return;
+ }
+
+ wpa_printf(MSG_DEBUG,
+ "WNM: scan: add 2/5 GHz channels as well");
+
+ for (i = 0; i < wpa_s->hw.num_modes; i++) {
+ struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i];
+ int j;
+
+ /* skip all the irrelevant modes */
+ if (mode->mode != HOSTAPD_MODE_IEEE80211B &&
+ mode->mode != HOSTAPD_MODE_IEEE80211G &&
+ mode->mode != HOSTAPD_MODE_IEEE80211A &&
+ mode->is_6ghz)
+ continue;
+
+ for (j = 0; j < mode->num_channels; j++) {
+ chan = &mode->channels[j];
+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
+ continue;
+
+ int_array_add_unique(&wpa_s->next_scan_freqs,
+ chan->freq);
+ }
+ }
+
+ wpa_printf(MSG_DEBUG,
+ "WNM: Scan %zu frequencies (including collocated)",
+ int_array_len(wpa_s->next_scan_freqs));
+ }
}
--
2.50.1
More information about the Hostap
mailing list