]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Fix pre-scan rejection heuristic for BTM handling
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 19 Sep 2024 10:19:16 +0000 (12:19 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Dec 2024 10:21:38 +0000 (12:21 +0200)
The idea was to only accept the cached scan results if the new target is
reasonably good. To avoid having to write a custom quality logic, a call
to wpa_supplicant_need_to_roam_within_ess() was used. However, the
intention was to swap the parameters and check whether we would want to
roam from the new BSS back to the current one.

Fix the heuristic to match the comment. To do that, we need to add a
parameter to not poll the current signal level as that would result in
comparing the current BSS with itself within the function.

Fixes: 20ed289a785c ("WNM: Clean up old scan data processing")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
wpa_supplicant/events.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant_i.h

index bab2145723baabd5ba12987a4aa62922675f4765..2f57d6b4881f31e683ccf729b2def1e492d59aa6 100644 (file)
@@ -2173,7 +2173,8 @@ static int wpas_evaluate_band_score(int frequency)
 
 int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
                                           struct wpa_bss *current_bss,
-                                          struct wpa_bss *selected)
+                                          struct wpa_bss *selected,
+                                          bool poll_current)
 {
        int min_diff, diff;
        int cur_band_score, sel_band_score;
@@ -2228,7 +2229,7 @@ int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
         * scan results may be a bit old, since we can very quickly get fresh
         * information about our currently associated AP.
         */
-       if (wpa_drv_signal_poll(wpa_s, &si) == 0 &&
+       if (poll_current && wpa_drv_signal_poll(wpa_s, &si) == 0 &&
            (si.data.avg_beacon_signal || si.data.avg_signal)) {
                /*
                 * Normalize avg_signal to the RSSI over 20 MHz, as the
@@ -2401,7 +2402,7 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 
 #ifndef CONFIG_NO_ROAMING
        return wpa_supplicant_need_to_roam_within_ess(wpa_s, current_bss,
-                                                     selected);
+                                                     selected, true);
 #else /* CONFIG_NO_ROAMING */
        return 0;
 #endif /* CONFIG_NO_ROAMING */
index 67e8df5f56a20e8877116d139f2a39b3bed40502..b5310f026bb510aeb6af5b8b8263fff09582f0b2 100644 (file)
@@ -1193,9 +1193,9 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check)
 
 #ifndef CONFIG_NO_ROAMING
                if (wpa_s->current_bss && bss != wpa_s->current_bss &&
-                   wpa_supplicant_need_to_roam_within_ess(wpa_s,
+                   wpa_supplicant_need_to_roam_within_ess(wpa_s, bss,
                                                           wpa_s->current_bss,
-                                                          bss))
+                                                          false))
                        return 0;
 #endif /* CONFIG_NO_ROAMING */
        }
index b077ee9f9f0c49cbbe5d85b22cbdd3a979c7bc4b..4fa463dc59d90e9b2c6bef2caf04d44be4929b64 100644 (file)
@@ -1888,7 +1888,8 @@ void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s,
                                        struct channel_list_changed *info);
 int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
                                           struct wpa_bss *current_bss,
-                                          struct wpa_bss *seleceted);
+                                          struct wpa_bss *selected,
+                                          bool poll_current);
 void wpas_reset_mlo_info(struct wpa_supplicant *wpa_s);
 
 /* eap_register.c */