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>
This commit is contained in:
parent
51b50fbeb5
commit
362a415dce
2 changed files with 40 additions and 6 deletions
|
@ -3563,6 +3563,38 @@ void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev)
|
||||||
genlmsg_multicast(msg, 0, nl80211_config_mcgrp.id, GFP_KERNEL);
|
genlmsg_multicast(msg, 0, nl80211_config_mcgrp.id, GFP_KERNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nl80211_add_scan_req(struct sk_buff *msg,
|
||||||
|
struct cfg80211_registered_device *rdev)
|
||||||
|
{
|
||||||
|
struct cfg80211_scan_request *req = rdev->scan_req;
|
||||||
|
struct nlattr *nest;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (WARN_ON(!req))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
nest = nla_nest_start(msg, NL80211_ATTR_SCAN_SSIDS);
|
||||||
|
if (!nest)
|
||||||
|
goto nla_put_failure;
|
||||||
|
for (i = 0; i < req->n_ssids; i++)
|
||||||
|
NLA_PUT(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid);
|
||||||
|
nla_nest_end(msg, nest);
|
||||||
|
|
||||||
|
nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES);
|
||||||
|
if (!nest)
|
||||||
|
goto nla_put_failure;
|
||||||
|
for (i = 0; i < req->n_channels; i++)
|
||||||
|
NLA_PUT_U32(msg, i, req->channels[i]->center_freq);
|
||||||
|
nla_nest_end(msg, nest);
|
||||||
|
|
||||||
|
if (req->ie)
|
||||||
|
NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
nla_put_failure:
|
||||||
|
return -ENOBUFS;
|
||||||
|
}
|
||||||
|
|
||||||
static int nl80211_send_scan_donemsg(struct sk_buff *msg,
|
static int nl80211_send_scan_donemsg(struct sk_buff *msg,
|
||||||
struct cfg80211_registered_device *rdev,
|
struct cfg80211_registered_device *rdev,
|
||||||
struct net_device *netdev,
|
struct net_device *netdev,
|
||||||
|
@ -3578,7 +3610,8 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg,
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
|
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
|
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
|
||||||
|
|
||||||
/* XXX: we should probably bounce back the request? */
|
/* ignore errors and send incomplete event anyway */
|
||||||
|
nl80211_add_scan_req(msg, rdev);
|
||||||
|
|
||||||
return genlmsg_end(msg, hdr);
|
return genlmsg_end(msg, hdr);
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,14 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
|
WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
|
||||||
wiphy_to_dev(request->wiphy)->scan_req = NULL;
|
|
||||||
|
|
||||||
if (aborted)
|
if (aborted)
|
||||||
nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev);
|
nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev);
|
||||||
else
|
else
|
||||||
nl80211_send_scan_done(wiphy_to_dev(request->wiphy), dev);
|
nl80211_send_scan_done(wiphy_to_dev(request->wiphy), dev);
|
||||||
|
|
||||||
|
wiphy_to_dev(request->wiphy)->scan_req = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_WIRELESS_EXT
|
#ifdef CONFIG_WIRELESS_EXT
|
||||||
if (!aborted) {
|
if (!aborted) {
|
||||||
memset(&wrqu, 0, sizeof(wrqu));
|
memset(&wrqu, 0, sizeof(wrqu));
|
||||||
|
|
Loading…
Reference in a new issue