summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_crypto_tkip.c
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-07-15 22:49:09 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-07-15 22:49:09 +0000
commit1cd56b31e3bb5eaffab676cf14d382a209377bb9 (patch)
treea38dbfc36ae47bf54aa7ec9fa988f11695986788 /sys/net80211/ieee80211_crypto_tkip.c
parentaceeb609d3c2b2949ebf3de3847789e92c66b2bd (diff)
ieee80211: track micfail timeout with getuptime(9) instead of ticks
With input from stsp@. ok stsp@
Diffstat (limited to 'sys/net80211/ieee80211_crypto_tkip.c')
-rw-r--r--sys/net80211/ieee80211_crypto_tkip.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_crypto_tkip.c b/sys/net80211/ieee80211_crypto_tkip.c
index 4c948bd21d6..2e39baf0b87 100644
--- a/sys/net80211/ieee80211_crypto_tkip.c
+++ b/sys/net80211/ieee80211_crypto_tkip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_crypto_tkip.c,v 1.31 2020/05/15 14:21:09 stsp Exp $ */
+/* $OpenBSD: ieee80211_crypto_tkip.c,v 1.32 2020/07/15 22:49:07 cheloha Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
@@ -537,7 +537,7 @@ ieee80211_michael_mic_failure_timeout(void *arg)
void
ieee80211_michael_mic_failure(struct ieee80211com *ic, u_int64_t tsc)
{
- extern int ticks;
+ time_t now;
#ifndef IEEE80211_STA_ONLY
int sec;
#endif
@@ -558,9 +558,9 @@ ieee80211_michael_mic_failure(struct ieee80211com *ic, u_int64_t tsc)
* Activate TKIP countermeasures (see 802.11-2012 11.4.2.4) if less than
* 60 seconds have passed since the most recent previous MIC failure.
*/
- if (ic->ic_tkip_micfail == 0 ||
- ticks - (ic->ic_tkip_micfail + 60 * hz) >= 0) {
- ic->ic_tkip_micfail = ticks;
+ now = getuptime();
+ if (ic->ic_tkip_micfail == 0 || ic->ic_tkip_micfail + 60 >= now) {
+ ic->ic_tkip_micfail = now;
ic->ic_tkip_micfail_last_tsc = tsc;
return;
}
@@ -607,7 +607,7 @@ ieee80211_michael_mic_failure(struct ieee80211com *ic, u_int64_t tsc)
break;
}
- ic->ic_tkip_micfail = ticks;
+ ic->ic_tkip_micfail = now;
ic->ic_tkip_micfail_last_tsc = tsc;
}