- Factor out ieee80211_reset_state() from ieee80211_newstate(), so
802.11 layer can clean up its internal state machine without state
changing or going through driver code.
- Merge sta_disassoc() and sta_disauth() into sta_disconnect(), which
sends disassoc to associated STA and deauth to authenticating STA.
- Call ieee80211_reset_state(), if operational mode is going to be
changed, so we will do a proper state machine clean up. In the
original way, if we are acting as AP and switch directly to act as
STA, we will send out wrong management frames.
- Call ieee80211_reset_state(), if PHY is going to be changed. This
prevents panic (due to a proper assertion) under following scenario:
o Current PHY of the AP is 11b.
o An 11b STA joins the BSS created by the AP. Since AP's current
PHY is 11b, this STA will not be counted as long slot time STA,
i.e. long slot time STA count left untouched.
o Switch AP's PHY to 11g.
AP will panick (long slot time STA count is zero, while there is a
long slot time STA associated, in ieee80211_node_leave_11g()). The
assertion fails, because 802.11 state machine is doing its clean up
as if AP were using 11g PHY, but it actually used 11b PHY.