AP: Use monotonic clock for SA query timeout

The usual, any timeouts should be using monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2013-11-25 21:56:09 +01:00 committed by Jouni Malinen
parent af5389610b
commit 10e694a618
3 changed files with 8 additions and 8 deletions

View file

@ -24,13 +24,13 @@ u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
{ {
u8 *pos = eid; u8 *pos = eid;
u32 timeout, tu; u32 timeout, tu;
struct os_time now, passed; struct os_reltime now, passed;
*pos++ = WLAN_EID_TIMEOUT_INTERVAL; *pos++ = WLAN_EID_TIMEOUT_INTERVAL;
*pos++ = 5; *pos++ = 5;
*pos++ = WLAN_TIMEOUT_ASSOC_COMEBACK; *pos++ = WLAN_TIMEOUT_ASSOC_COMEBACK;
os_get_time(&now); os_get_reltime(&now);
os_time_sub(&now, &sta->sa_query_start, &passed); os_reltime_sub(&now, &sta->sa_query_start, &passed);
tu = (passed.sec * 1000000 + passed.usec) / 1024; tu = (passed.sec * 1000000 + passed.usec) / 1024;
if (hapd->conf->assoc_sa_query_max_timeout > tu) if (hapd->conf->assoc_sa_query_max_timeout > tu)
timeout = hapd->conf->assoc_sa_query_max_timeout - tu; timeout = hapd->conf->assoc_sa_query_max_timeout - tu;

View 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) int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
{ {
u32 tu; u32 tu;
struct os_time now, passed; struct os_reltime now, passed;
os_get_time(&now); os_get_reltime(&now);
os_time_sub(&now, &sta->sa_query_start, &passed); os_reltime_sub(&now, &sta->sa_query_start, &passed);
tu = (passed.sec * 1000000 + passed.usec) / 1024; tu = (passed.sec * 1000000 + passed.usec) / 1024;
if (hapd->conf->assoc_sa_query_max_timeout < tu) { if (hapd->conf->assoc_sa_query_max_timeout < tu) {
hostapd_logger(hapd, sta->addr, hostapd_logger(hapd, sta->addr,
@ -864,7 +864,7 @@ static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
return; return;
if (sta->sa_query_count == 0) { if (sta->sa_query_count == 0) {
/* Starting a new SA Query procedure */ /* 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; trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
sta->sa_query_trans_id = nbuf; sta->sa_query_trans_id = nbuf;

View file

@ -113,7 +113,7 @@ struct sta_info {
u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN * u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
* sa_query_count octets of pending SA Query * sa_query_count octets of pending SA Query
* transaction identifiers */ * transaction identifiers */
struct os_time sa_query_start; struct os_reltime sa_query_start;
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_INTERWORKING #ifdef CONFIG_INTERWORKING