diff options
author | sam <sam@FreeBSD.org> | 2009-01-28 19:23:12 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-01-28 19:23:12 +0000 |
commit | 85eedef5da0512806dcc0324a4f8ceff39afc392 (patch) | |
tree | c107afc2c97de46caba73a5f526436c8c6ebdc03 /sbin | |
parent | 9ef1936e4c61504fb348cf13b9dd5f7bf28a1b19 (diff) | |
download | FreeBSD-src-85eedef5da0512806dcc0324a4f8ceff39afc392.zip FreeBSD-src-85eedef5da0512806dcc0324a4f8ceff39afc392.tar.gz |
pritize the channel we display with list chans so that, among other
things, 1/2 and 1/4 width channels are hidden behind the full width
channel; this is needed because they are ordered such that they
appear after in the channel table
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifieee80211.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index d93ef71..cf38719 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -3156,6 +3156,30 @@ print_chaninfo(const struct ieee80211_channel *c, int verb) get_chaninfo(c, verb, buf, sizeof(buf))); } +static int +chanpref(const struct ieee80211_channel *c) +{ + if (IEEE80211_IS_CHAN_HT40(c)) + return 40; + if (IEEE80211_IS_CHAN_HT20(c)) + return 30; + if (IEEE80211_IS_CHAN_HALF(c)) + return 10; + if (IEEE80211_IS_CHAN_QUARTER(c)) + return 5; + if (IEEE80211_IS_CHAN_TURBO(c)) + return 25; + if (IEEE80211_IS_CHAN_A(c)) + return 20; + if (IEEE80211_IS_CHAN_G(c)) + return 20; + if (IEEE80211_IS_CHAN_B(c)) + return 15; + if (IEEE80211_IS_CHAN_PUREG(c)) + return 15; + return 0; +} + static void print_channels(int s, const struct ieee80211req_chaninfo *chans, int allchans, int verb) @@ -3199,7 +3223,10 @@ print_channels(int s, const struct ieee80211req_chaninfo *chans, /* suppress duplicates as above */ if (isset(reported, c->ic_ieee) && !verb) { /* XXX we assume duplicates are adjacent */ - achans->ic_chans[achans->ic_nchans-1] = *c; + struct ieee80211_channel *a = + &achans->ic_chans[achans->ic_nchans-1]; + if (chanpref(c) > chanpref(a)) + *a = *c; } else { achans->ic_chans[achans->ic_nchans++] = *c; setbit(reported, c->ic_ieee); |