* IEEE80211_M_WDS vap state machine handler. */
| 345 | * IEEE80211_M_WDS vap state machine handler. |
| 346 | */ |
| 347 | static int |
| 348 | wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) |
| 349 | { |
| 350 | struct ieee80211com *ic = vap->iv_ic; |
| 351 | enum ieee80211_state ostate; |
| 352 | int error; |
| 353 | |
| 354 | IEEE80211_LOCK_ASSERT(ic); |
| 355 | |
| 356 | ostate = vap->iv_state; |
| 357 | IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s\n", __func__, |
| 358 | ieee80211_state_name[ostate], ieee80211_state_name[nstate]); |
| 359 | vap->iv_state = nstate; /* state transition */ |
| 360 | callout_stop(&vap->iv_mgtsend); /* XXX callout_drain */ |
| 361 | if (ostate != IEEE80211_S_SCAN) |
| 362 | ieee80211_cancel_scan(vap); /* background scan */ |
| 363 | error = 0; |
| 364 | switch (nstate) { |
| 365 | case IEEE80211_S_INIT: |
| 366 | switch (ostate) { |
| 367 | case IEEE80211_S_SCAN: |
| 368 | ieee80211_cancel_scan(vap); |
| 369 | break; |
| 370 | default: |
| 371 | break; |
| 372 | } |
| 373 | if (ostate != IEEE80211_S_INIT) { |
| 374 | /* NB: optimize INIT -> INIT case */ |
| 375 | ieee80211_reset_bss(vap); |
| 376 | } |
| 377 | break; |
| 378 | case IEEE80211_S_SCAN: |
| 379 | switch (ostate) { |
| 380 | case IEEE80211_S_INIT: |
| 381 | ieee80211_check_scan_current(vap); |
| 382 | break; |
| 383 | default: |
| 384 | break; |
| 385 | } |
| 386 | break; |
| 387 | case IEEE80211_S_RUN: |
| 388 | if (ostate == IEEE80211_S_INIT) { |
| 389 | /* |
| 390 | * Already have a channel; bypass the scan |
| 391 | * and startup immediately. |
| 392 | */ |
| 393 | error = ieee80211_create_wds(vap, ic->ic_curchan); |
| 394 | } |
| 395 | break; |
| 396 | default: |
| 397 | break; |
| 398 | } |
| 399 | return error; |
| 400 | } |
| 401 | |
| 402 | /* |
| 403 | * Process a received frame. The node associated with the sender |
nothing calls this directly
no test coverage detected