]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Use monotonic clock for SA query timeout
authorJohannes Berg <johannes.berg@intel.com>
Mon, 25 Nov 2013 20:56:09 +0000 (21:56 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 8 Dec 2013 04:50:15 +0000 (20:50 -0800)
The usual, any timeouts should be using monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

src/ap/ieee802_11_shared.c
src/ap/sta_info.c
src/ap/sta_info.h

index 76688b513ace767881f9571fdebea90de65a1cb8..eadaa4d187ffc2b145c3699db6ed835c2ba866da 100644 (file)
@@ -24,13 +24,13 @@ u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
 {
        u8 *pos = eid;
        u32 timeout, tu;
-       struct os_time now, passed;
+       struct os_reltime now, passed;
 
        *pos++ = WLAN_EID_TIMEOUT_INTERVAL;
        *pos++ = 5;
        *pos++ = WLAN_TIMEOUT_ASSOC_COMEBACK;
-       os_get_time(&now);
-       os_time_sub(&now, &sta->sa_query_start, &passed);
+       os_get_reltime(&now);
+       os_reltime_sub(&now, &sta->sa_query_start, &passed);
        tu = (passed.sec * 1000000 + passed.usec) / 1024;
        if (hapd->conf->assoc_sa_query_max_timeout > tu)
                timeout = hapd->conf->assoc_sa_query_max_timeout - tu;
index 474597edbcc4ca96dd1f5546364b49c14d863b20..d1d8657199b9dd052d5bae3623bf940223e34395 100644 (file)
@@ -825,9 +825,9 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
 {
        u32 tu;
-       struct os_time now, passed;
-       os_get_time(&now);
-       os_time_sub(&now, &sta->sa_query_start, &passed);
+       struct os_reltime now, passed;
+       os_get_reltime(&now);
+       os_reltime_sub(&now, &sta->sa_query_start, &passed);
        tu = (passed.sec * 1000000 + passed.usec) / 1024;
        if (hapd->conf->assoc_sa_query_max_timeout < tu) {
                hostapd_logger(hapd, sta->addr,
@@ -864,7 +864,7 @@ static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
                return;
        if (sta->sa_query_count == 0) {
                /* Starting a new SA Query procedure */
-               os_get_time(&sta->sa_query_start);
+               os_get_reltime(&sta->sa_query_start);
        }
        trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
        sta->sa_query_trans_id = nbuf;
index 5dfe1aaeb9cd149966259677868fa2719d592e0d..ea3fe40731e1c6beb6c4c38e2b069ba2d418adb1 100644 (file)
@@ -113,7 +113,7 @@ struct sta_info {
        u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
                                * sa_query_count octets of pending SA Query
                                * transaction identifiers */
-       struct os_time sa_query_start;
+       struct os_reltime sa_query_start;
 #endif /* CONFIG_IEEE80211W */
 
 #ifdef CONFIG_INTERWORKING