aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-05-24 10:43:15 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-03 14:05:10 -0400
commit362a415dce2130b0e4cebfc8f8fbd8128baff308 (patch)
tree6d93d638116b7083bc34a1ef15057024cacd6bf9 /net/wireless
parent51b50fbeb574f581c0b112e035541f42fa3e604a (diff)
nl80211: bounce scan request back to userspace
When a scan finishes only the program that asked for it knows what kind of scan it was; let's tell everybody else about the scan parameters as well so they can evaluate the result of the scan better. Also helps with debugging. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c43
-rw-r--r--net/wireless/scan.c3
2 files changed, 40 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 19dc796bb0b8..909ebd6ec78b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3563,11 +3563,43 @@ void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev)
3563 genlmsg_multicast(msg, 0, nl80211_config_mcgrp.id, GFP_KERNEL); 3563 genlmsg_multicast(msg, 0, nl80211_config_mcgrp.id, GFP_KERNEL);
3564} 3564}
3565 3565
3566static int nl80211_add_scan_req(struct sk_buff *msg,
3567 struct cfg80211_registered_device *rdev)
3568{
3569 struct cfg80211_scan_request *req = rdev->scan_req;
3570 struct nlattr *nest;
3571 int i;
3572
3573 if (WARN_ON(!req))
3574 return 0;
3575
3576 nest = nla_nest_start(msg, NL80211_ATTR_SCAN_SSIDS);
3577 if (!nest)
3578 goto nla_put_failure;
3579 for (i = 0; i < req->n_ssids; i++)
3580 NLA_PUT(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid);
3581 nla_nest_end(msg, nest);
3582
3583 nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES);
3584 if (!nest)
3585 goto nla_put_failure;
3586 for (i = 0; i < req->n_channels; i++)
3587 NLA_PUT_U32(msg, i, req->channels[i]->center_freq);
3588 nla_nest_end(msg, nest);
3589
3590 if (req->ie)
3591 NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie);
3592
3593 return 0;
3594 nla_put_failure:
3595 return -ENOBUFS;
3596}
3597
3566static int nl80211_send_scan_donemsg(struct sk_buff *msg, 3598static int nl80211_send_scan_donemsg(struct sk_buff *msg,
3567 struct cfg80211_registered_device *rdev, 3599 struct cfg80211_registered_device *rdev,
3568 struct net_device *netdev, 3600 struct net_device *netdev,
3569 u32 pid, u32 seq, int flags, 3601 u32 pid, u32 seq, int flags,
3570 u32 cmd) 3602 u32 cmd)
3571{ 3603{
3572 void *hdr; 3604 void *hdr;
3573 3605
@@ -3578,7 +3610,8 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg,
3578 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); 3610 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
3579 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 3611 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
3580 3612
3581 /* XXX: we should probably bounce back the request? */ 3613 /* ignore errors and send incomplete event anyway */
3614 nl80211_add_scan_req(msg, rdev);
3582 3615
3583 return genlmsg_end(msg, hdr); 3616 return genlmsg_end(msg, hdr);
3584 3617
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index df59440290e5..e95b638b919f 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -29,13 +29,14 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
29 goto out; 29 goto out;
30 30
31 WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); 31 WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
32 wiphy_to_dev(request->wiphy)->scan_req = NULL;
33 32
34 if (aborted) 33 if (aborted)
35 nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev); 34 nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev);
36 else 35 else
37 nl80211_send_scan_done(wiphy_to_dev(request->wiphy), dev); 36 nl80211_send_scan_done(wiphy_to_dev(request->wiphy), dev);
38 37
38 wiphy_to_dev(request->wiphy)->scan_req = NULL;
39
39#ifdef CONFIG_WIRELESS_EXT 40#ifdef CONFIG_WIRELESS_EXT
40 if (!aborted) { 41 if (!aborted) {
41 memset(&wrqu, 0, sizeof(wrqu)); 42 memset(&wrqu, 0, sizeof(wrqu));