]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Update BSS entry on roaming only for actual BSS frequency change
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 20 Mar 2024 09:08:16 +0000 (11:08 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 20 Mar 2024 09:08:16 +0000 (11:08 +0200)
Commit 117e812d06e6 ("Update BSS table entry if roaming event indicates
frequency change") added wpa_supplicant BSS table update based on the
latest driver scan results whenever processing an association event that
results in the current operating channel changing. While that is needed
to cover the case where an AP changes its own operating channel (and
that is noticed as a roam or new connection instead of a channel switch
event), this should not really be needed for cases where the
wpa_supplicant entry for the new BSS is already up to date.

Skip the full BSS table update on association event if the event is for
a roaming case to a different BSS and the BSS entry for the target is
already available and for the current operating channel. This avoids
undesired latency when processing the association event.

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

index f9ee7c0b6d26f6205cabbe008baab2220bb8a107..c32610f9fd2426d690acd577766a0661073a3f88 100644 (file)
@@ -3622,12 +3622,21 @@ no_pfs:
        if (wpa_found || rsn_found)
                wpa_s->ap_ies_from_associnfo = 1;
 
-       if (wpa_s->assoc_freq && data->assoc_info.freq &&
-           wpa_s->assoc_freq != data->assoc_info.freq) {
-               wpa_printf(MSG_DEBUG, "Operating frequency changed from "
-                          "%u to %u MHz",
-                          wpa_s->assoc_freq, data->assoc_info.freq);
-               wpa_supplicant_update_scan_results(wpa_s);
+       if (wpa_s->assoc_freq && data->assoc_info.freq) {
+               struct wpa_bss *bss;
+               unsigned int freq = 0;
+
+               if (bssid_known) {
+                       bss = wpa_bss_get_bssid_latest(wpa_s, bssid);
+                       if (bss)
+                               freq = bss->freq;
+               }
+               if (freq != data->assoc_info.freq) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Operating frequency changed from %u to %u MHz",
+                                  wpa_s->assoc_freq, data->assoc_info.freq);
+                       wpa_supplicant_update_scan_results(wpa_s);
+               }
        }
 
        wpa_s->assoc_freq = data->assoc_info.freq;