From 85817ec3681b80bb53262e834ecd34682be232fe Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 12 Dec 2005 18:38:20 +0000 Subject: o correct auto mode logic for avoiding turbo channels o correct assumption that a static turbo channel is also usable in 11a; the opposite is true MFC after: 1 week --- sys/net80211/ieee80211.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 5bd64a4..9b1fa0b 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -807,9 +807,11 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) modeflags = chanflags[mode]; for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; + if (c->ic_flags == 0) + continue; if (mode == IEEE80211_MODE_AUTO) { /* ignore turbo channels for autoselect */ - if ((c->ic_flags &~ IEEE80211_CHAN_TURBO) != 0) + if ((c->ic_flags & IEEE80211_CHAN_TURBO) == 0) break; } else { if ((c->ic_flags & modeflags) == modeflags) @@ -828,9 +830,11 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active)); for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; + if (c->ic_flags == 0) + continue; if (mode == IEEE80211_MODE_AUTO) { /* take anything but pure turbo channels */ - if ((c->ic_flags &~ IEEE80211_CHAN_TURBO) != 0) + if ((c->ic_flags & IEEE80211_CHAN_TURBO) == 0) setbit(ic->ic_chan_active, i); } else { if ((c->ic_flags & modeflags) == modeflags) @@ -905,13 +909,9 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *ic, struct ieee80211_channel *chan) { - if (IEEE80211_IS_CHAN_5GHZ(chan)) { - /* - * This assumes all 11a turbo channels are also - * usable withut turbo, which is currently true. - */ - if (ic->ic_curmode == IEEE80211_MODE_TURBO_A) - return IEEE80211_MODE_TURBO_A; + if (IEEE80211_IS_CHAN_T(chan)) { + return IEEE80211_MODE_TURBO_A; + } else if (IEEE80211_IS_CHAN_5GHZ(chan)) { return IEEE80211_MODE_11A; } else if (IEEE80211_IS_CHAN_FHSS(chan)) return IEEE80211_MODE_FH; -- cgit v1.1