diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-06-16 13:56:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 14:57:53 -0400 |
commit | a538e2d5a30f577e9c8f6ccfe72b29a258e0fe86 (patch) | |
tree | 56bc91e64d25fc4fdc1f00f01e0afa8be519e252 /net/wireless/nl80211.c | |
parent | 222ec50a0a5d20e75522aacf4c767df6585e8548 (diff) |
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: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f91e5d472c60..5a6c4ca59398 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2839,6 +2839,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2839 | drv->scan_req = request; | 2839 | drv->scan_req = request; |
2840 | err = drv->ops->scan(&drv->wiphy, dev, request); | 2840 | err = drv->ops->scan(&drv->wiphy, dev, request); |
2841 | 2841 | ||
2842 | if (!err) | ||
2843 | nl80211_send_scan_start(drv, dev); | ||
2844 | |||
2842 | out_free: | 2845 | out_free: |
2843 | if (err) { | 2846 | if (err) { |
2844 | drv->scan_req = NULL; | 2847 | drv->scan_req = NULL; |
@@ -3665,11 +3668,11 @@ static int nl80211_add_scan_req(struct sk_buff *msg, | |||
3665 | return -ENOBUFS; | 3668 | return -ENOBUFS; |
3666 | } | 3669 | } |
3667 | 3670 | ||
3668 | static int nl80211_send_scan_donemsg(struct sk_buff *msg, | 3671 | static int nl80211_send_scan_msg(struct sk_buff *msg, |
3669 | struct cfg80211_registered_device *rdev, | 3672 | struct cfg80211_registered_device *rdev, |
3670 | struct net_device *netdev, | 3673 | struct net_device *netdev, |
3671 | u32 pid, u32 seq, int flags, | 3674 | u32 pid, u32 seq, int flags, |
3672 | u32 cmd) | 3675 | u32 cmd) |
3673 | { | 3676 | { |
3674 | void *hdr; | 3677 | void *hdr; |
3675 | 3678 | ||
@@ -3690,6 +3693,24 @@ static int nl80211_send_scan_donemsg(struct sk_buff *msg, | |||
3690 | return -EMSGSIZE; | 3693 | return -EMSGSIZE; |
3691 | } | 3694 | } |
3692 | 3695 | ||
3696 | void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, | ||
3697 | struct net_device *netdev) | ||
3698 | { | ||
3699 | struct sk_buff *msg; | ||
3700 | |||
3701 | msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); | ||
3702 | if (!msg) | ||
3703 | return; | ||
3704 | |||
3705 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, | ||
3706 | NL80211_CMD_TRIGGER_SCAN) < 0) { | ||
3707 | nlmsg_free(msg); | ||
3708 | return; | ||
3709 | } | ||
3710 | |||
3711 | genlmsg_multicast(msg, 0, nl80211_scan_mcgrp.id, GFP_KERNEL); | ||
3712 | } | ||
3713 | |||
3693 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | 3714 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, |
3694 | struct net_device *netdev) | 3715 | struct net_device *netdev) |
3695 | { | 3716 | { |
@@ -3699,8 +3720,8 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | |||
3699 | if (!msg) | 3720 | if (!msg) |
3700 | return; | 3721 | return; |
3701 | 3722 | ||
3702 | if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0, | 3723 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, |
3703 | NL80211_CMD_NEW_SCAN_RESULTS) < 0) { | 3724 | NL80211_CMD_NEW_SCAN_RESULTS) < 0) { |
3704 | nlmsg_free(msg); | 3725 | nlmsg_free(msg); |
3705 | return; | 3726 | return; |
3706 | } | 3727 | } |
@@ -3717,8 +3738,8 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, | |||
3717 | if (!msg) | 3738 | if (!msg) |
3718 | return; | 3739 | return; |
3719 | 3740 | ||
3720 | if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0, | 3741 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, |
3721 | NL80211_CMD_SCAN_ABORTED) < 0) { | 3742 | NL80211_CMD_SCAN_ABORTED) < 0) { |
3722 | nlmsg_free(msg); | 3743 | nlmsg_free(msg); |
3723 | return; | 3744 | return; |
3724 | } | 3745 | } |