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

Function hostap_newstate

freebsd/net80211/ieee80211_hostap.c:159–357  ·  view source on GitHub ↗

* IEEE80211_M_HOSTAP vap state machine handler. */

Source from the content-addressed store, hash-verified

157 * IEEE80211_M_HOSTAP vap state machine handler.
158 */
159static int
160hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
161{
162 struct ieee80211com *ic = vap->iv_ic;
163 enum ieee80211_state ostate;
164
165 IEEE80211_LOCK_ASSERT(ic);
166
167 ostate = vap->iv_state;
168 IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n",
169 __func__, ieee80211_state_name[ostate],
170 ieee80211_state_name[nstate], arg);
171 vap->iv_state = nstate; /* state transition */
172 if (ostate != IEEE80211_S_SCAN)
173 ieee80211_cancel_scan(vap); /* background scan */
174 switch (nstate) {
175 case IEEE80211_S_INIT:
176 switch (ostate) {
177 case IEEE80211_S_SCAN:
178 ieee80211_cancel_scan(vap);
179 break;
180 case IEEE80211_S_CAC:
181 ieee80211_dfs_cac_stop(vap);
182 break;
183 case IEEE80211_S_RUN:
184 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap,
185 sta_disassoc, NULL);
186 break;
187 default:
188 break;
189 }
190 if (ostate != IEEE80211_S_INIT) {
191 /* NB: optimize INIT -> INIT case */
192 ieee80211_reset_bss(vap);
193 }
194 if (vap->iv_auth->ia_detach != NULL)
195 vap->iv_auth->ia_detach(vap);
196 break;
197 case IEEE80211_S_SCAN:
198 switch (ostate) {
199 case IEEE80211_S_CSA:
200 case IEEE80211_S_RUN:
201 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap,
202 sta_disassoc, NULL);
203 /*
204 * Clear overlapping BSS state; the beacon frame
205 * will be reconstructed on transition to the RUN
206 * state and the timeout routines check if the flag
207 * is set before doing anything so this is sufficient.
208 */
209 vap->iv_flags_ext &= ~IEEE80211_FEXT_NONERP_PR;
210 vap->iv_flags_ht &= ~IEEE80211_FHT_NONHT_PR;
211 /* XXX TODO: schedule deferred update? */
212 /* fall thru... */
213 case IEEE80211_S_CAC:
214 /*
215 * NB: We may get here because of a manual channel
216 * change in which case we need to stop CAC

Callers

nothing calls this directly

Calls 15

ieee80211_cancel_scanFunction · 0.85
ieee80211_dfs_cac_stopFunction · 0.85
ieee80211_reset_bssFunction · 0.85
ieee80211_check_scanFunction · 0.85
ieee80211_dfs_cac_startFunction · 0.85
ieee80211_node_set_chanFunction · 0.85
ieee80211_htchanflagsFunction · 0.85
ieee80211_noteFunction · 0.85
ether_sprintfFunction · 0.85

Tested by

no test coverage detected