diff options
author | sam <sam@FreeBSD.org> | 2009-06-03 23:33:09 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-06-03 23:33:09 +0000 |
commit | eb121f1d68f3072586c07ae95f68dfa309b2d6b8 (patch) | |
tree | 44f62b68ce9fe0c15e1bb21fc9f6d584807443ee | |
parent | b4921daa19788bf8b239aaa35eac15086b1f0bb7 (diff) | |
download | FreeBSD-src-eb121f1d68f3072586c07ae95f68dfa309b2d6b8.zip FreeBSD-src-eb121f1d68f3072586c07ae95f68dfa309b2d6b8.tar.gz |
When a channel switch is done to a channel with different operating
characteristics force the stations to re-associate so protocol state
is re-initialized. Note that for 11h/DFS this is irrelevant as channel
changes are never cross-band.
Reviewed by: ctlaw
-rw-r--r-- | sys/net80211/ieee80211_hostap.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 5d9c8e4..625ee98 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -127,6 +127,28 @@ sta_csa(void *arg, struct ieee80211_node *ni) } } +static void +sta_drop(void *arg, struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = arg; + + if (ni->ni_vap == vap && ni->ni_associd != 0) + ieee80211_node_leave(ni); +} + +/* + * Does a channel change require associated stations to re-associate + * so protocol state is correct. This is used when doing CSA across + * bands or similar (e.g. HT -> legacy). + */ +static int +isbandchange(struct ieee80211com *ic) +{ + return ((ic->ic_bsschan->ic_flags ^ ic->ic_csa_newchan->ic_flags) & + (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HALF | + IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HT)) != 0; +} + /* * IEEE80211_M_HOSTAP vap state machine handler. */ @@ -307,6 +329,18 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) } ieee80211_node_authorize(vap->iv_bss); break; + case IEEE80211_S_CSA: + if (ostate == IEEE80211_S_RUN && isbandchange(ic)) { + /* + * On a ``band change'' silently drop associated + * stations as they must re-associate before they + * can pass traffic (as otherwise protocol state + * such as capabilities and the negotiated rate + * set may/will be wrong). + */ + ieee80211_iterate_nodes(&ic->ic_sta, sta_drop, vap); + } + break; default: break; } |