diff options
author | sam <sam@FreeBSD.org> | 2009-02-19 04:44:18 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-02-19 04:44:18 +0000 |
commit | e092563f43c0d85d32cfa3385af35c502368cc3e (patch) | |
tree | 2dc764a3c4e9832f14f288e51f5b0126834e54c8 /sys/net80211/ieee80211_regdomain.c | |
parent | fe861a3d8d52e95e4b0f5f4727ef776824b94ce7 (diff) | |
download | FreeBSD-src-e092563f43c0d85d32cfa3385af35c502368cc3e.zip FreeBSD-src-e092563f43c0d85d32cfa3385af35c502368cc3e.tar.gz |
Change country ie construction to simplify forthcoming changes:
o use c99 initializer for skipflags
o calculate band flags instead of statically listing them in the table
Diffstat (limited to 'sys/net80211/ieee80211_regdomain.c')
-rw-r--r-- | sys/net80211/ieee80211_regdomain.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c index 91cf810..724f32a 100644 --- a/sys/net80211/ieee80211_regdomain.c +++ b/sys/net80211/ieee80211_regdomain.c @@ -216,17 +216,19 @@ ieee80211_alloc_countryie(struct ieee80211com *ic) /* XXX what about auto? */ /* flag set of channels to be excluded */ static const int skipflags[IEEE80211_MODE_MAX] = { - CHAN_UNINTERESTING, /* MODE_AUTO */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_11A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11B */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11G */ - CHAN_UNINTERESTING | IEEE80211_CHAN_OFDM | /* MODE_FH */ - IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN, - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_TURBO_A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_TURBO_G */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_STURBO_A */ - CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ, /* MODE_11NA */ - CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ, /* MODE_11NG */ + [IEEE80211_MODE_AUTO] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11B] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11G] = CHAN_UNINTERESTING, + [IEEE80211_MODE_FH] = CHAN_UNINTERESTING + | IEEE80211_CHAN_OFDM + | IEEE80211_CHAN_CCK + | IEEE80211_CHAN_DYN, + [IEEE80211_MODE_TURBO_A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_TURBO_G] = CHAN_UNINTERESTING, + [IEEE80211_MODE_STURBO_A] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11NA] = CHAN_UNINTERESTING, + [IEEE80211_MODE_11NG] = CHAN_UNINTERESTING, }; const struct ieee80211_regdomain *rd = &ic->ic_regdomain; uint8_t nextchan, chans[IEEE80211_CHAN_BYTES], *frm; @@ -268,6 +270,10 @@ ieee80211_alloc_countryie(struct ieee80211com *ic) nruns = 0; memset(chans, 0, sizeof(chans)); skip = skipflags[ieee80211_chan2mode(ic->ic_bsschan)]; + if (IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) + skip |= IEEE80211_CHAN_2GHZ; + else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_bsschan)) + skip |= IEEE80211_CHAN_5GHZ; for (i = 0; i < ic->ic_nchans; i++) { const struct ieee80211_channel *c = &ic->ic_channels[i]; |