aboutsummaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2005-08-10 16:22:30 +0000
committerSam Leffler <sam@FreeBSD.org>2005-08-10 16:22:30 +0000
commitb5c9941514a11ce20e15aebce59c994fd33b5230 (patch)
treeb9c0e277abb905c850c4e7b7e0d8615bf32983ff /sys/net80211/ieee80211_ioctl.c
parent44938dbf6d09781698be6fdae1c2e070de44e837 (diff)
downloadsrc-b5c9941514a11ce20e15aebce59c994fd33b5230.tar.gz
src-b5c9941514a11ce20e15aebce59c994fd33b5230.zip
Clarify/fix handling of the current channel:
o add ic_curchan and use it uniformly for specifying the current channel instead of overloading ic->ic_bss->ni_chan (or in some drivers ic_ibss_chan) o add ieee80211_scanparams structure to encapsulate scanning-related state captured for rx frames o move rx beacon+probe response frame handling into separate routines o change beacon+probe response handling to treat the scan table more like a scan cache--look for an existing entry before adding a new one; this combined with ic_curchan use corrects handling of stations that were previously found at a different channel o move adhoc neighbor discovery by beacon+probe response frames to a new ieee80211_add_neighbor routine Reviewed by: avatar Tested by: avatar, Michal Mertl MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=148936
Diffstat (limited to 'sys/net80211/ieee80211_ioctl.c')
-rw-r--r--sys/net80211/ieee80211_ioctl.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index db9439f47d9c..e8cf5c4e4f17 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -252,7 +252,7 @@ ieee80211_cfgget(struct ieee80211com *ic, u_long cmd, caddr_t data)
break;
case WI_RID_CURRENT_CHAN:
wreq.wi_val[0] = htole16(
- ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan));
+ ieee80211_chan2ieee(ic, ic->ic_curchan));
wreq.wi_len = 1;
break;
case WI_RID_COMMS_QUALITY:
@@ -448,7 +448,6 @@ findrate(struct ieee80211com *ic, enum ieee80211_phymode mode, int rate)
static int
ieee80211_setupscan(struct ieee80211com *ic, const u_int8_t chanlist[])
{
- int i;
/*
* XXX don't permit a scan to be started unless we
@@ -460,20 +459,6 @@ ieee80211_setupscan(struct ieee80211com *ic, const u_int8_t chanlist[])
*/
if (!IS_UP(ic))
return EINVAL;
- if (ic->ic_ibss_chan == NULL ||
- isclr(chanlist, ieee80211_chan2ieee(ic, ic->ic_ibss_chan))) {
- for (i = 0; i <= IEEE80211_CHAN_MAX; i++)
- if (isset(chanlist, i)) {
- ic->ic_ibss_chan = &ic->ic_channels[i];
- goto found;
- }
- return EINVAL; /* no active channels */
-found:
- ;
- }
- if (ic->ic_bss->ni_chan == IEEE80211_CHAN_ANYC ||
- isclr(chanlist, ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan)))
- ic->ic_bss->ni_chan = ic->ic_ibss_chan;
memcpy(ic->ic_chan_active, chanlist, sizeof(ic->ic_chan_active));
/*
* We force the state to INIT before calling ieee80211_new_state
@@ -827,18 +812,6 @@ ieee80211_cfgset(struct ieee80211com *ic, u_long cmd, caddr_t data)
return error;
}
-static struct ieee80211_channel *
-getcurchan(struct ieee80211com *ic)
-{
- switch (ic->ic_state) {
- case IEEE80211_S_INIT:
- case IEEE80211_S_SCAN:
- return ic->ic_des_chan;
- default:
- return ic->ic_ibss_chan;
- }
-}
-
static int
cap2cipher(int flag)
{
@@ -1351,7 +1324,7 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
ireq->i_val = ic->ic_bss->ni_authmode;
break;
case IEEE80211_IOC_CHANNEL:
- ireq->i_val = ieee80211_chan2ieee(ic, getcurchan(ic));
+ ireq->i_val = ieee80211_chan2ieee(ic, ic->ic_curchan);
break;
case IEEE80211_IOC_POWERSAVE:
if (ic->ic_flags & IEEE80211_F_PMGTON)
@@ -1841,9 +1814,6 @@ found:
;
}
memcpy(ic->ic_chan_active, chanlist, sizeof(ic->ic_chan_active));
- if (ic->ic_bss->ni_chan == IEEE80211_CHAN_ANYC ||
- isclr(chanlist, ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan)))
- ic->ic_bss->ni_chan = ic->ic_ibss_chan;
return IS_UP_AUTO(ic) ? ENETRESET : 0;
}