* IEEE80211_M_HOSTAP vap state machine handler. */
| 157 | * IEEE80211_M_HOSTAP vap state machine handler. |
| 158 | */ |
| 159 | static int |
| 160 | hostap_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 |
nothing calls this directly
no test coverage detected