aboutsummaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2008-12-15 01:26:33 +0000
committerSam Leffler <sam@FreeBSD.org>2008-12-15 01:26:33 +0000
commit31378b1c87ab8e6c51deb3fb67d3e21a4e456b9f (patch)
treec93f57c8693451ef5985e24651f8da4d8456781a /sys/net80211/ieee80211_ioctl.c
parent831133450339b4b3a1389e8f5478d445e1be30e5 (diff)
downloadsrc-31378b1c87ab8e6c51deb3fb67d3e21a4e456b9f.tar.gz
src-31378b1c87ab8e6c51deb3fb67d3e21a4e456b9f.zip
Fix definition of IEEE80211_CHAN_MAX; it was defined as 255 but
really was meant to be 256. Adjust usage accordingly and replace bogus usage of this value in checking IEEE channel #'s. NB: this causes an ABI change; ifconfig must be recompiled
Notes
Notes: svn path=/head/; revision=186107
Diffstat (limited to 'sys/net80211/ieee80211_ioctl.c')
-rw-r--r--sys/net80211/ieee80211_ioctl.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index ae39fd68a504..797ed8f91f8f 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1556,7 +1556,7 @@ ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211req_chanlist list;
u_char chanlist[IEEE80211_CHAN_BYTES];
- int i, j, nchan, error;
+ int i, nchan, error;
if (ireq->i_len != sizeof(list))
return EINVAL;
@@ -1564,22 +1564,16 @@ ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
if (error)
return error;
memset(chanlist, 0, sizeof(chanlist));
- /*
- * Since channel 0 is not available for DS, channel 1
- * is assigned to LSB on WaveLAN.
- */
- if (ic->ic_phytype == IEEE80211_T_DS)
- i = 1;
- else
- i = 0;
nchan = 0;
- for (j = 0; i <= IEEE80211_CHAN_MAX; i++, j++) {
+ for (i = 0; i < ic->ic_nchans; i++) {
+ const struct ieee80211_channel *c = &ic->ic_channels[i];
/*
- * NB: silently discard unavailable channels so users
- * can specify 1-255 to get all available channels.
+ * Calculate the intersection of the user list and the
+ * available channels so users can do things like specify
+ * 1-255 to get all available channels.
*/
- if (isset(list.ic_channels, j) && isset(ic->ic_chan_avail, i)) {
- setbit(chanlist, i);
+ if (isset(list.ic_channels, c->ic_ieee)) {
+ setbit(chanlist, c->ic_ieee);
nchan++;
}
}
@@ -1890,8 +1884,6 @@ ieee80211_ioctl_setchannel(struct ieee80211vap *vap,
if (ireq->i_val == 0 ||
ireq->i_val == (int16_t) IEEE80211_CHAN_ANY) {
c = IEEE80211_CHAN_ANYC;
- } else if ((u_int) ireq->i_val > IEEE80211_CHAN_MAX) {
- return EINVAL;
} else {
struct ieee80211_channel *c2;