diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-10 15:25:55 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:49 -0500 |
commit | 2a5193119269062608582418deba7af82844159a (patch) | |
tree | 1f2fe8cffbeb7530dce7fa708310f6fb29ab0dd8 /net/mac80211/mlme.c | |
parent | 849b7967818995a32c3017542e33eb3155944368 (diff) |
cfg80211/nl80211: scanning (and mac80211 update to use it)
This patch adds basic scan capability to cfg80211/nl80211 and
changes mac80211 to use it. The BSS list that cfg80211 maintains
is made driver-accessible with a private area in each BSS struct,
but mac80211 doesn't yet use it. That's another large project.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index bfc47b330687..46b4817cdea9 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1743,7 +1743,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1743 | } | 1743 | } |
1744 | 1744 | ||
1745 | bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, | 1745 | bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, |
1746 | freq, beacon); | 1746 | channel, beacon); |
1747 | if (!bss) | 1747 | if (!bss) |
1748 | return; | 1748 | return; |
1749 | 1749 | ||
@@ -2162,7 +2162,15 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, | |||
2162 | 2162 | ||
2163 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 2163 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
2164 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); | 2164 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); |
2165 | ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len); | 2165 | |
2166 | /* XXX maybe racy? */ | ||
2167 | if (sdata->local->scan_req) | ||
2168 | return; | ||
2169 | |||
2170 | memcpy(sdata->local->int_scan_req.ssids[0].ssid, | ||
2171 | ifsta->ssid, IEEE80211_MAX_SSID_LEN); | ||
2172 | sdata->local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len; | ||
2173 | ieee80211_request_scan(sdata, &sdata->local->int_scan_req); | ||
2166 | } | 2174 | } |
2167 | 2175 | ||
2168 | 2176 | ||
@@ -2378,8 +2386,15 @@ dont_join: | |||
2378 | IEEE80211_SCAN_INTERVAL)) { | 2386 | IEEE80211_SCAN_INTERVAL)) { |
2379 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 2387 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
2380 | "join\n", sdata->dev->name); | 2388 | "join\n", sdata->dev->name); |
2381 | return ieee80211_request_scan(sdata, ifsta->ssid, | 2389 | |
2382 | ifsta->ssid_len); | 2390 | /* XXX maybe racy? */ |
2391 | if (local->scan_req) | ||
2392 | return -EBUSY; | ||
2393 | |||
2394 | memcpy(local->int_scan_req.ssids[0].ssid, | ||
2395 | ifsta->ssid, IEEE80211_MAX_SSID_LEN); | ||
2396 | local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len; | ||
2397 | return ieee80211_request_scan(sdata, &local->int_scan_req); | ||
2383 | } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { | 2398 | } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { |
2384 | int interval = IEEE80211_SCAN_INTERVAL; | 2399 | int interval = IEEE80211_SCAN_INTERVAL; |
2385 | 2400 | ||
@@ -2478,11 +2493,16 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | |||
2478 | } else { | 2493 | } else { |
2479 | if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { | 2494 | if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { |
2480 | ifsta->assoc_scan_tries++; | 2495 | ifsta->assoc_scan_tries++; |
2496 | /* XXX maybe racy? */ | ||
2497 | if (local->scan_req) | ||
2498 | return -1; | ||
2499 | memcpy(local->int_scan_req.ssids[0].ssid, | ||
2500 | ifsta->ssid, IEEE80211_MAX_SSID_LEN); | ||
2481 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) | 2501 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) |
2482 | ieee80211_start_scan(sdata, NULL, 0); | 2502 | local->int_scan_req.ssids[0].ssid_len = 0; |
2483 | else | 2503 | else |
2484 | ieee80211_start_scan(sdata, ifsta->ssid, | 2504 | local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len; |
2485 | ifsta->ssid_len); | 2505 | ieee80211_start_scan(sdata, &local->int_scan_req); |
2486 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; | 2506 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; |
2487 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | 2507 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); |
2488 | } else { | 2508 | } else { |
@@ -2520,8 +2540,7 @@ static void ieee80211_sta_work(struct work_struct *work) | |||
2520 | ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && | 2540 | ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
2521 | ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && | 2541 | ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && |
2522 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { | 2542 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { |
2523 | ieee80211_start_scan(sdata, ifsta->scan_ssid, | 2543 | ieee80211_start_scan(sdata, local->scan_req); |
2524 | ifsta->scan_ssid_len); | ||
2525 | return; | 2544 | return; |
2526 | } | 2545 | } |
2527 | 2546 | ||