Index: head/sys/net80211/ieee80211_proto.c =================================================================== --- head/sys/net80211/ieee80211_proto.c +++ head/sys/net80211/ieee80211_proto.c @@ -1531,7 +1531,7 @@ IEEE80211_LOCK(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { /* - * We only pass events through for sta vap's in RUN state; + * We only pass events through for sta vap's in RUN+ state; * may be too restrictive but for now this saves all the * handlers duplicating these checks. */ @@ -1550,7 +1550,7 @@ struct ieee80211com *ic = vap->iv_ic; IEEE80211_LOCK(ic); - if (vap->iv_state == IEEE80211_S_RUN) { + if (vap->iv_state >= IEEE80211_S_RUN) { /* XXX Call multiple times if npending > zero? */ vap->iv_bmiss(vap); } @@ -1570,8 +1570,7 @@ IEEE80211_LOCK_ASSERT(ic); - /* XXX sleep state? */ - KASSERT(vap->iv_state == IEEE80211_S_RUN, + KASSERT(vap->iv_state >= IEEE80211_S_RUN, ("wrong state %d", vap->iv_state)); if (ic->ic_flags & IEEE80211_F_SCAN) { Index: head/sys/net80211/ieee80211_sta.c =================================================================== --- head/sys/net80211/ieee80211_sta.c +++ head/sys/net80211/ieee80211_sta.c @@ -206,6 +206,24 @@ } } +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. @@ -419,19 +437,8 @@ 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. @@ -451,6 +458,7 @@ goto invalid; break; case IEEE80211_S_SLEEP: + sta_swbmiss_start(vap); vap->iv_sta_ps(vap, 1); break; default: