[PATCH 20/23] wpa_supplicant: use monotonic time for temp-disabled networks

Johannes Berg johannes
Mon Dec 16 12:08:41 PST 2013


From: Johannes Berg <johannes.berg at intel.com>

Temporarily disabled networks are disabled for a certain
duration, so the code should use monotonic time.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 wpa_supplicant/config_ssid.h    | 2 +-
 wpa_supplicant/events.c         | 4 ++--
 wpa_supplicant/wpa_supplicant.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 0102da9..c8837eb 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -610,7 +610,7 @@ struct wpa_ssid {
 	/**
 	 * disabled_until - Network block disabled until this time if non-zero
 	 */
-	struct os_time disabled_until;
+	struct os_reltime disabled_until;
 
 	/**
 	 * parent_cred - Pointer to parent wpa_cred entry
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 21a1132..fd12cf8 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -53,12 +53,12 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
 static int wpas_temp_disabled(struct wpa_supplicant *wpa_s,
 			      struct wpa_ssid *ssid)
 {
-	struct os_time now;
+	struct os_reltime now;
 
 	if (ssid == NULL || ssid->disabled_until.sec == 0)
 		return 0;
 
-	os_get_time(&now);
+	os_get_reltime(&now);
 	if (ssid->disabled_until.sec > now.sec)
 		return ssid->disabled_until.sec - now.sec;
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index fc8b777..49ed75b 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3978,7 +3978,7 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s)
 {
 	struct wpa_ssid *ssid = wpa_s->current_ssid;
 	int dur;
-	struct os_time now;
+	struct os_reltime now;
 
 	if (ssid == NULL) {
 		wpa_printf(MSG_DEBUG, "Authentication failure but no known "
@@ -4015,7 +4015,7 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s)
 	else
 		dur = 10;
 
-	os_get_time(&now);
+	os_get_reltime(&now);
 	if (now.sec + dur <= ssid->disabled_until.sec)
 		return;
 
-- 
1.8.5.1




More information about the Hostap mailing list