From: Ilan Peer <ilan.peer@xxxxxxxxx> 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@xxxxxxxxx> Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx> --- v2: - fix logic to skip non 2.4/5 GHz channels Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx> --- wpa_supplicant/wnm_sta.c | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index a3de2b2e1d..7b14315944 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -737,9 +737,7 @@ fetch_drv_mbo_candidate_info(struct wpa_supplicant *wpa_s, pos = params.bssid; for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { nei = &wpa_s->wnm_neighbor_report_elements[i]; - nei->drv_mbo_reject = 0; - if (nei->preference_present && nei->preference == 0) continue; @@ -1153,7 +1151,9 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) struct neighbor_report *nei; nei = &wpa_s->wnm_neighbor_report_elements[i]; + bss = wpa_bss_get_bssid(wpa_s, nei->bssid); + if (bss && bss->level > wpa_s->conf->disassoc_imminent_rssi_threshold) { nei->drv_mbo_reject = 0; @@ -1333,6 +1333,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; @@ -1363,6 +1364,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) @@ -1371,6 +1373,70 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s) wpa_printf(MSG_DEBUG, "WNM: Scan %zu 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 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap