]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add WPA_EVENT_{DO,SKIP}_ROAM events
authorMatthew Wang <matthewmwang@chromium.org>
Tue, 2 Jun 2020 00:10:18 +0000 (17:10 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 19 Jun 2020 15:34:26 +0000 (18:34 +0300)
Add events for within-ESS reassociation. This allows us to monitor roam
events, both skipped and allowed, in tests.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
src/common/wpa_ctrl.h
wpa_supplicant/events.c

index 58ce10141c6003dfbb62bee7dbd9d5bd0894ab50..f5199de9aa8be939853f3855b768771d789992f7 100644 (file)
@@ -97,6 +97,10 @@ extern "C" {
        "CTRL-EVENT-SAE-UNKNOWN-PASSWORD-IDENTIFIER "
 /** Unprotected Beacon frame dropped */
 #define WPA_EVENT_UNPROT_BEACON "CTRL-EVENT-UNPROT-BEACON "
+/** Decision made to do a within-ESS roam */
+#define WPA_EVENT_DO_ROAM "CTRL-EVENT-DO-ROAM "
+/** Decision made to skip a within-ESS roam */
+#define WPA_EVENT_SKIP_ROAM "CTRL-EVENT-SKIP-ROAM "
 
 /** IP subnet status change notification
  *
index e3cf853931b244db3f2167169a9da22ba8a4a240..0fcb1762e822f35c3cc526f6960e3fe5d33ace5a 100644 (file)
@@ -1866,6 +1866,7 @@ int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
        unsigned int cur_est, sel_est;
        struct wpa_signal_info si;
        int cur_snr = 0;
+       int ret = 0;
 
        wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
        wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR
@@ -1985,13 +1986,22 @@ int wpa_supplicant_need_to_roam_within_ess(struct wpa_supplicant *wpa_s,
                wpa_dbg(wpa_s, MSG_DEBUG,
                        "Skip roam - too small difference in signal level (%d < %d)",
                        diff, min_diff);
-               return 0;
+               ret = 0;
+       } else {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Allow reassociation due to difference in signal level (%d >= %d)",
+                       diff, min_diff);
+               ret = 1;
        }
-
-       wpa_dbg(wpa_s, MSG_DEBUG,
-               "Allow reassociation due to difference in signal level (%d >= %d)",
-               diff, min_diff);
-       return 1;
+       wpa_msg_ctrl(wpa_s, MSG_INFO, "%scur_bssid=" MACSTR
+                    " cur_freq=%d cur_level=%d cur_est=%d sel_bssid=" MACSTR
+                    " sel_freq=%d sel_level=%d sel_est=%d",
+                    ret ? WPA_EVENT_DO_ROAM : WPA_EVENT_SKIP_ROAM,
+                    MAC2STR(current_bss->bssid),
+                    current_bss->freq, cur_level, cur_est,
+                    MAC2STR(selected->bssid),
+                    selected->freq, selected->level, sel_est);
+       return ret;
 }
 
 #endif /* CONFIG_NO_ROAMING */