aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/events.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-12-16 20:08:42 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-24 06:18:47 (GMT)
commit6473e5c842e9c541c7bb96ea59611b56b15ea157 (patch)
tree006fd8aa51de96c9f012352482124cdceb40bfec /wpa_supplicant/events.c
parent4e1eae1dff54295d5d8036f8aeb4d84fbd38f7fa (diff)
downloadhostap-6473e5c842e9c541c7bb96ea59611b56b15ea157.zip
hostap-6473e5c842e9c541c7bb96ea59611b56b15ea157.tar.gz
hostap-6473e5c842e9c541c7bb96ea59611b56b15ea157.tar.bz2
wpa_supplicant: Use relative time for TKIP Michael MIC failures
The MMIC failure code should use monotonic time to check whether 60 seconds have elapsed or not. For type-safety, use struct os_reltime for the timestamp variable, and also convert to using os_reltime_expired(). Signed-hostap: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'wpa_supplicant/events.c')
-rw-r--r--wpa_supplicant/events.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index fd12cf8..fa5d681 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2183,13 +2183,13 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
{
int pairwise;
- struct os_time t;
+ struct os_reltime t;
wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected");
pairwise = (data && data->michael_mic_failure.unicast);
- os_get_time(&t);
- if ((wpa_s->last_michael_mic_error &&
- t.sec - wpa_s->last_michael_mic_error <= 60) ||
+ os_get_reltime(&t);
+ if ((wpa_s->last_michael_mic_error.sec &&
+ !os_reltime_expired(&t, &wpa_s->last_michael_mic_error, 60)) ||
wpa_s->pending_mic_error_report) {
if (wpa_s->pending_mic_error_report) {
/*
@@ -2267,7 +2267,7 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
#endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
}
- wpa_s->last_michael_mic_error = t.sec;
+ wpa_s->last_michael_mic_error = t;
wpa_s->mic_errors_seen++;
}