Commit a538e2d5 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

cfg80211: issue netlink notification when scan starts

To ease multiple apps working together smoothly,
send a notification when a scan is started.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 222ec50a
...@@ -2839,6 +2839,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -2839,6 +2839,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
drv->scan_req = request; drv->scan_req = request;
err = drv->ops->scan(&drv->wiphy, dev, request); err = drv->ops->scan(&drv->wiphy, dev, request);
if (!err)
nl80211_send_scan_start(drv, dev);
out_free: out_free:
if (err) { if (err) {
drv->scan_req = NULL; drv->scan_req = NULL;
...@@ -3665,7 +3668,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg, ...@@ -3665,7 +3668,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
return -ENOBUFS; return -ENOBUFS;
} }
static int nl80211_send_scan_donemsg(struct sk_buff *msg, static int nl80211_send_scan_msg(struct sk_buff *msg,
struct cfg80211_registered_device *rdev, struct cfg80211_registered_device *rdev,
struct net_device *netdev, struct net_device *netdev,
u32 pid, u32 seq, int flags, u32 pid, u32 seq, int flags,
...@@ -3690,6 +3693,24 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg, ...@@ -3690,6 +3693,24 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg,
return -EMSGSIZE; return -EMSGSIZE;
} }
void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
struct net_device *netdev)
{
struct sk_buff *msg;
msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!msg)
return;
if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
NL80211_CMD_TRIGGER_SCAN) < 0) {
nlmsg_free(msg);
return;
}
genlmsg_multicast(msg, 0, nl80211_scan_mcgrp.id, GFP_KERNEL);
}
void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
struct net_device *netdev) struct net_device *netdev)
{ {
...@@ -3699,7 +3720,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, ...@@ -3699,7 +3720,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
if (!msg) if (!msg)
return; return;
if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0, if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
NL80211_CMD_NEW_SCAN_RESULTS) < 0) { NL80211_CMD_NEW_SCAN_RESULTS) < 0) {
nlmsg_free(msg); nlmsg_free(msg);
return; return;
...@@ -3717,7 +3738,7 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, ...@@ -3717,7 +3738,7 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
if (!msg) if (!msg)
return; return;
if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0, if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0,
NL80211_CMD_SCAN_ABORTED) < 0) { NL80211_CMD_SCAN_ABORTED) < 0) {
nlmsg_free(msg); nlmsg_free(msg);
return; return;
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
extern int nl80211_init(void); extern int nl80211_init(void);
extern void nl80211_exit(void); extern void nl80211_exit(void);
extern void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); extern void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev);
extern void nl80211_send_scan_start(struct cfg80211_registered_device *rdev,
struct net_device *netdev);
extern void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, extern void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
struct net_device *netdev); struct net_device *netdev);
extern void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, extern void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
......
...@@ -647,7 +647,8 @@ int cfg80211_wext_siwscan(struct net_device *dev, ...@@ -647,7 +647,8 @@ int cfg80211_wext_siwscan(struct net_device *dev,
if (err) { if (err) {
rdev->scan_req = NULL; rdev->scan_req = NULL;
kfree(creq); kfree(creq);
} } else
nl80211_send_scan_start(rdev, dev);
out: out:
cfg80211_put_dev(rdev); cfg80211_put_dev(rdev);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment