summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_sta.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net80211/ieee80211_sta.c')
-rw-r--r--sys/net80211/ieee80211_sta.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index ee14ffd..16d801c 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -206,6 +206,24 @@ sta_authretry(struct ieee80211vap *vap, struct ieee80211_node *ni, int reason)
}
}
+static void
+sta_swbmiss_start(struct ieee80211vap *vap)
+{
+
+ if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) {
+ /*
+ * Start s/w beacon miss timer for devices w/o
+ * hardware support. We fudge a bit here since
+ * we're doing this in software.
+ */
+ vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
+ 2 * vap->iv_bmissthreshold * vap->iv_bss->ni_intval);
+ vap->iv_swbmiss_count = 0;
+ callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
+ ieee80211_swbmiss, vap);
+ }
+}
+
/*
* IEEE80211_M_STA vap state machine handler.
* This routine handles the main states in the 802.11 protocol.
@@ -341,12 +359,13 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
break;
}
break;
+ case IEEE80211_S_SLEEP:
case IEEE80211_S_RUN:
switch (arg & 0xff) {
case IEEE80211_FC0_SUBTYPE_AUTH:
IEEE80211_SEND_MGMT(ni,
IEEE80211_FC0_SUBTYPE_AUTH, 2);
- vap->iv_state = ostate; /* stay RUN */
+ vap->iv_state = IEEE80211_S_RUN; /* stay RUN */
break;
case IEEE80211_FC0_SUBTYPE_DEAUTH:
ieee80211_sta_leave(ni);
@@ -418,19 +437,8 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
goto invalid;
}
ieee80211_sync_curchan(ic);
- if (ostate != IEEE80211_S_RUN &&
- (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
- /*
- * Start s/w beacon miss timer for devices w/o
- * hardware support. We fudge a bit here since
- * we're doing this in software.
- */
- vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
- 2 * vap->iv_bmissthreshold * ni->ni_intval);
- vap->iv_swbmiss_count = 0;
- callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
- ieee80211_swbmiss, vap);
- }
+ if (ostate != IEEE80211_S_RUN)
+ sta_swbmiss_start(vap);
/*
* When 802.1x is not in use mark the port authorized
* at this point so traffic can flow.
@@ -450,6 +458,7 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
goto invalid;
break;
case IEEE80211_S_SLEEP:
+ sta_swbmiss_start(vap);
vap->iv_sta_ps(vap, 1);
break;
default:
@@ -1244,7 +1253,7 @@ contbgscan(struct ieee80211vap *vap)
return ((ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN) &&
(ic->ic_flags & IEEE80211_F_CSAPENDING) == 0 &&
vap->iv_state == IEEE80211_S_RUN && /* XXX? */
- time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle));
+ ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle));
}
/*
@@ -1265,8 +1274,8 @@ startbgscan(struct ieee80211vap *vap)
#ifdef IEEE80211_SUPPORT_SUPERG
!IEEE80211_IS_CHAN_DTURBO(ic->ic_curchan) &&
#endif
- time_after(ticks, ic->ic_lastscan + vap->iv_bgscanintvl) &&
- time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle));
+ ieee80211_time_after(ticks, ic->ic_lastscan + vap->iv_bgscanintvl) &&
+ ieee80211_time_after(ticks, ic->ic_lastdata + vap->iv_bgscanidle));
}
static void
OpenPOWER on IntegriCloud