MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sta_newstate

Function sta_newstate

freebsd/net80211/ieee80211_sta.c:233–474  ·  view source on GitHub ↗

* IEEE80211_M_STA vap state machine handler. * This routine handles the main states in the 802.11 protocol. */

Source from the content-addressed store, hash-verified

231 * This routine handles the main states in the 802.11 protocol.
232 */
233static int
234sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
235{
236 struct ieee80211com *ic = vap->iv_ic;
237 struct ieee80211_node *ni;
238 enum ieee80211_state ostate;
239
240 IEEE80211_LOCK_ASSERT(ic);
241
242 ostate = vap->iv_state;
243 IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n",
244 __func__, ieee80211_state_name[ostate],
245 ieee80211_state_name[nstate], arg);
246 vap->iv_state = nstate; /* state transition */
247 callout_stop(&vap->iv_mgtsend); /* XXX callout_drain */
248 if (ostate != IEEE80211_S_SCAN)
249 ieee80211_cancel_scan(vap); /* background scan */
250 ni = vap->iv_bss; /* NB: no reference held */
251 if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)
252 callout_stop(&vap->iv_swbmiss);
253 switch (nstate) {
254 case IEEE80211_S_INIT:
255 switch (ostate) {
256 case IEEE80211_S_SLEEP:
257 /* XXX wakeup */
258 /* XXX driver hook to wakeup the hardware? */
259 case IEEE80211_S_RUN:
260 IEEE80211_SEND_MGMT(ni,
261 IEEE80211_FC0_SUBTYPE_DISASSOC,
262 IEEE80211_REASON_ASSOC_LEAVE);
263 ieee80211_sta_leave(ni);
264 break;
265 case IEEE80211_S_ASSOC:
266 IEEE80211_SEND_MGMT(ni,
267 IEEE80211_FC0_SUBTYPE_DEAUTH,
268 IEEE80211_REASON_AUTH_LEAVE);
269 break;
270 case IEEE80211_S_SCAN:
271 ieee80211_cancel_scan(vap);
272 break;
273 default:
274 break;
275 }
276 if (ostate != IEEE80211_S_INIT) {
277 /* NB: optimize INIT -> INIT case */
278 ieee80211_reset_bss(vap);
279 }
280 if (vap->iv_auth->ia_detach != NULL)
281 vap->iv_auth->ia_detach(vap);
282 break;
283 case IEEE80211_S_SCAN:
284 switch (ostate) {
285 case IEEE80211_S_INIT:
286 /*
287 * Initiate a scan. We can come here as a result
288 * of an IEEE80211_IOC_SCAN_REQ too in which case
289 * the vap will be marked with IEEE80211_FEXT_SCANREQ
290 * and the scan request parameters will be present

Callers

nothing calls this directly

Calls 15

ieee80211_cancel_scanFunction · 0.85
ieee80211_sta_leaveFunction · 0.85
ieee80211_reset_bssFunction · 0.85
ieee80211_check_scanFunction · 0.85
sta_authretryFunction · 0.85
ieee80211_noteFunction · 0.85
ether_sprintfFunction · 0.85
ieee80211_print_essidFunction · 0.85
ieee80211_chan2ieeeFunction · 0.85

Tested by

no test coverage detected