aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-23 10:01:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:31 -0400
commitf3b85252f081581a8f257545ed748062dce7798b (patch)
tree899a804545850c7e1b1e3eea5c743df2c8cddf3d /net/mac80211/ibss.c
parent2d72289095e9621158acf1d59a830cfe920fa93b (diff)
mac80211: fix scan races and rework scanning
There are some places marked /* XXX maybe racy? */ and they really are racy because there's no locking. This patch reworks much of the scan code, and introduces proper locking for the scan request as well as the internal scanning (which is necessary for IBSS/managed modes). Helper functions are added to call the scanning code whenever necessary. The scan deferring is changed to simply queue the scanning work instead of trying to start the scan in place, the scanning work will then take care of the rest. Also, currently when internal scans are requested for an interface that is trying to associate, we reject such scans. This was not intended, the mlme code has provisions to scan twice when it can't find the BSS to associate with right away; this has never worked properly. Fix this by not rejecting internal scan requests for an interface that is associating. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 9fe1f937e0b4..25ff583612ef 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -432,15 +432,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
432 printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " 432 printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
433 "IBSS networks with same SSID (merge)\n", sdata->dev->name); 433 "IBSS networks with same SSID (merge)\n", sdata->dev->name);
434 434
435 /* XXX maybe racy? */ 435 ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len);
436 if (sdata->local->scan_req)
437 return;
438
439 memcpy(sdata->local->int_scan_req.ssids[0].ssid,
440 ifibss->ssid, IEEE80211_MAX_SSID_LEN);
441 sdata->local->int_scan_req.ssids[0].ssid_len = ifibss->ssid_len;
442 if (ieee80211_request_scan(sdata, &sdata->local->int_scan_req))
443 ieee80211_scan_failed(sdata->local);
444} 436}
445 437
446static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) 438static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
@@ -553,16 +545,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
553 printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " 545 printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
554 "join\n", sdata->dev->name); 546 "join\n", sdata->dev->name);
555 547
556 /* XXX maybe racy? */ 548 ieee80211_request_internal_scan(sdata, ifibss->ssid,
557 if (local->scan_req) 549 ifibss->ssid_len);
558 return;
559
560 memcpy(local->int_scan_req.ssids[0].ssid,
561 ifibss->ssid, IEEE80211_MAX_SSID_LEN);
562 local->int_scan_req.ssids[0].ssid_len =
563 ifibss->ssid_len;
564 if (ieee80211_request_scan(sdata, &local->int_scan_req))
565 ieee80211_scan_failed(local);
566 } else if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) { 550 } else if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) {
567 int interval = IEEE80211_SCAN_INTERVAL; 551 int interval = IEEE80211_SCAN_INTERVAL;
568 552