[PATCH 7/7] wpa_supplicant: update current BSS level when signal change event occurs

Ilan Peer ilan.peer at intel.com
Tue Feb 17 21:35:15 EST 2015


From: Matthieu Mauger <matthieux.mauger at intel.com>

When an “EVENT_SIGNAL_CHANGE” occurs the bgscan is informed about this change
but the new RSSI value is not stored. In consequence, when roaming candidates
are evaluated, the RSSI value of the current BSS used to compare is an old one
obtained during the last scan rather than the new one given by the signal change
event. This leads sometimes to bad decision when selecting a new BSS for
roaming.

This patch solves the issue by updating the current BSS level when receiving a
signal change event in order to have a very up-to-date current signal value when
choosing an new BSS.

Signed-off-by: Matthieu Mauger <matthieux.mauger at intel.com>
---
 wpa_supplicant/bss.h    |  6 ++++++
 wpa_supplicant/events.c | 12 +++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h
index bdd240e..c86f1d9 100644
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h
@@ -137,4 +137,10 @@ static inline int bss_is_dmg(const struct wpa_bss *bss)
 	return bss->freq > 45000;
 }
 
+static inline void wpa_bss_update_level(struct wpa_bss *bss, int new_level)
+{
+	if (bss != NULL && new_level < 0)
+		bss->level = new_level;
+}
+
 #endif /* BSS_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 72a7368..7acc5f4 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3426,11 +3426,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		break;
 	case EVENT_SIGNAL_CHANGE:
 		wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
-			"above=%d signal=%d noise=%d txrate=%d",
-			data->signal_change.above_threshold,
-			data->signal_change.current_signal,
-			data->signal_change.current_noise,
-			data->signal_change.current_txrate);
+				"above=%d signal=%d noise=%d txrate=%d",
+				data->signal_change.above_threshold,
+				data->signal_change.current_signal,
+				data->signal_change.current_noise,
+				data->signal_change.current_txrate);
+		wpa_bss_update_level(wpa_s->current_bss,
+				     data->signal_change.current_signal);
 		bgscan_notify_signal_change(
 			wpa_s, data->signal_change.above_threshold,
 			data->signal_change.current_signal,
-- 
1.8.3.2



More information about the HostAP mailing list