diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-09-08 17:47:23 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-11 15:53:37 -0400 |
commit | 9116dd01120e249dc2e84e6edecd7ad7f828680f (patch) | |
tree | e08ccb8239f9130dcf2fc0e27b4d97151dac9238 /net/mac80211/scan.c | |
parent | bacac545f10f2bf6e5ceff0d8e2b82dfc493602a (diff) | |
download | lwn-9116dd01120e249dc2e84e6edecd7ad7f828680f.tar.gz lwn-9116dd01120e249dc2e84e6edecd7ad7f828680f.zip |
mac80211: clarify scan request
When a scan is requested for non-STA interfaces, we simply fire
off a scan, but for STA interfaces we shouldn't because they
could be in the middle of an association. This clarifies the
corresponding code.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 1beefb5ad6fb..9f6120150120 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -674,23 +674,32 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len) { - struct ieee80211_if_sta *ifsta = &sdata->u.sta; struct ieee80211_local *local = sdata->local; + struct ieee80211_if_sta *ifsta; if (sdata->vif.type != IEEE80211_IF_TYPE_STA) return ieee80211_sta_start_scan(sdata, ssid, ssid_len); + /* + * STA has a state machine that might need to defer scanning + * while it's trying to associate/authenticate, therefore we + * queue it up to the state machine in that case. + */ + if (local->sta_sw_scanning || local->sta_hw_scanning) { if (local->scan_sdata == sdata) return 0; return -EBUSY; } + ifsta = &sdata->u.sta; + ifsta->scan_ssid_len = ssid_len; if (ssid_len) memcpy(ifsta->scan_ssid, ssid, ssid_len); set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request); queue_work(local->hw.workqueue, &ifsta->work); + return 0; } |