PERFORCE change 87165 for review
Sam Leffler
sam at FreeBSD.org
Wed Nov 23 17:48:45 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=87165
Change 87165 by sam at sam_ebb on 2005/11/24 01:48:18
explicitly sync scanner state when we move directly to RUN
state (i.e. w/o scanning)
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#38 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan.c#6 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_scan.h#4 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#38 (text+ko) ====
@@ -1011,9 +1011,11 @@
ic->ic_opmode == IEEE80211_M_AHDEMO) &&
ic->ic_des_chan != IEEE80211_CHAN_ANYC) {
/*
- * AP operation and we already have a channel;
- * bypass the scan and startup immediately.
+ * Already have a channel; bypass the
+ * scan and startup immediately. Because
+ * of this explicitly sync the scanner state.
*/
+ ieee80211_scan_update(ic);
ieee80211_create_ibss(ic, ic->ic_des_chan);
} else {
ieee80211_check_scan(ic,
@@ -1143,8 +1145,10 @@
ic->ic_opmode == IEEE80211_M_HOSTAP) {
/*
* Already have a channel; bypass the
- * scan and startup immediately.
+ * scan and startup immediately. Because
+ * of this explicitly sync the scanner state.
*/
+ ieee80211_scan_update(ic);
ieee80211_create_ibss(ic, ic->ic_curchan);
break;
}
==== //depot/projects/wifi/sys/net80211/ieee80211_scan.c#6 (text+ko) ====
@@ -193,6 +193,45 @@
scanners[m] = NULL;
}
+/*
+ * Update common scanner state to reflect the current
+ * operating mode. This is called when the state machine
+ * is transitioned to RUN state w/o scanning--e.g. when
+ * operating in monitor mode. The purpose of this is to
+ * ensure later callbacks find ss_ops set to properly
+ * reflect current operating mode.
+ */
+int
+ieee80211_scan_update(struct ieee80211com *ic)
+{
+ struct ieee80211_scan_state *ss = ic->ic_scan;
+ const struct ieee80211_scanner *scan;
+
+ scan = ieee80211_scanner_get(ic->ic_opmode);
+ IEEE80211_LOCK(ic);
+ if (scan == NULL) {
+ IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN,
+ "%s: no scanner support for mode %u\n",
+ __func__, ic->ic_opmode);
+ /* XXX stat */
+ }
+ ss->ss_ic = ic;
+ if (ss->ss_ops != scan) {
+ /* switch scanners; detach old, attach new */
+ if (ss->ss_ops != NULL)
+ ss->ss_ops->scan_detach(ss);
+ if (scan != NULL && !scan->scan_attach(ss)) {
+ /* XXX attach failure */
+ /* XXX stat+msg */
+ ss->ss_ops = NULL;
+ } else
+ ss->ss_ops = scan;
+ }
+ IEEE80211_UNLOCK(ic);
+
+ return (scan != NULL);
+}
+
static void
change_channel(struct ieee80211com *ic,
struct ieee80211_channel *chan)
==== //depot/projects/wifi/sys/net80211/ieee80211_scan.h#4 (text+ko) ====
@@ -80,6 +80,7 @@
void ieee80211_scan_dump_channels(const struct ieee80211_scan_state *);
+int ieee80211_scan_update(struct ieee80211com *);
#define IEEE80211_SCAN_FOREVER 0x7fffffff
int ieee80211_start_scan(struct ieee80211com *, int flags, u_int duration,
u_int nssid, const struct ieee80211_scan_ssid ssids[]);
More information about the p4-projects
mailing list