From b97aa038b7e2be722b9d362c8645a763009969d6 Mon Sep 17 00:00:00 2001 From: Matthew Wang Date: Mon, 1 Jun 2020 17:10:18 -0700 Subject: [PATCH] Add WPA_EVENT_{DO,SKIP}_ROAM events Add events for within-ESS reassociation. This allows us to monitor roam events, both skipped and allowed, in tests. Signed-off-by: Matthew Wang --- src/common/wpa_ctrl.h | 4 ++++ wpa_supplicant/events.c | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 58ce10141..f5199de9a 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -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 * diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e3cf85393..0fcb1762e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -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 */