aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-25 20:56:06 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-08 04:50:15 (GMT)
commit100298e896d95fd59a312aaa6100ed7bbcff930d (patch)
treeffa4591ea4a621759930d3fac040ea9f2e64e302
parente5c9e401a4496ee8015cd6e27fdf806739f7ceed (diff)
downloadhostap-100298e896d95fd59a312aaa6100ed7bbcff930d.zip
hostap-100298e896d95fd59a312aaa6100ed7bbcff930d.tar.gz
hostap-100298e896d95fd59a312aaa6100ed7bbcff930d.tar.bz2
AP: Use monotonic time for AP list
Use the new monotonic time to keep track of when an AP entry expires. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--src/ap/ap_list.c12
-rw-r--r--src/ap/ap_list.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c
index 9f02151..0dab39f 100644
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -172,7 +172,6 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
struct hostapd_frame_info *fi)
{
struct ap_info *ap;
- struct os_time now;
int new_ap = 0;
int set_beacon = 0;
@@ -210,8 +209,7 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
else
ap->ht_support = 0;
- os_get_time(&now);
- ap->last_beacon = now.sec;
+ os_get_reltime(&ap->last_beacon);
if (!new_ap && ap != iface->ap_list) {
/* move AP entry into the beginning of the list so that the
@@ -252,7 +250,7 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
static void ap_list_timer(void *eloop_ctx, void *timeout_ctx)
{
struct hostapd_iface *iface = eloop_ctx;
- struct os_time now;
+ struct os_reltime now;
struct ap_info *ap;
int set_beacon = 0;
@@ -261,12 +259,12 @@ static void ap_list_timer(void *eloop_ctx, void *timeout_ctx)
if (!iface->ap_list)
return;
- os_get_time(&now);
+ os_get_reltime(&now);
while (iface->ap_list) {
ap = iface->ap_list->prev;
- if (ap->last_beacon + iface->conf->ap_table_expiration_time >=
- now.sec)
+ if (!os_reltime_expired(&now, &ap->last_beacon,
+ iface->conf->ap_table_expiration_time))
break;
ap_free_ap(iface, ap);
diff --git a/src/ap/ap_list.h b/src/ap/ap_list.h
index d0529a1..93dc0ed 100644
--- a/src/ap/ap_list.h
+++ b/src/ap/ap_list.h
@@ -26,7 +26,7 @@ struct ap_info {
int ht_support;
- os_time_t last_beacon;
+ struct os_reltime last_beacon;
};
struct ieee802_11_elems;