aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-01-24 08:06:29 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-02-04 15:58:08 -0500
commit348baf0eac3391c62d441ec29b4c5da62ed91e74 (patch)
treed8255b3c6b16e330fc97671c5afcd666bee5a9be /net/wireless/nl80211.c
parentd8ca16db6bb23d03fcb794df44bae64ae976f27c (diff)
nl80211: send event when AP operation is stopped
There are a few cases, e.g. suspend, where an AP interface is stopped by the kernel rather than by userspace request, most commonly when suspending. To let userspace know about this, send the NL80211_CMD_STOP_AP command as an event every time an AP interface is stopped. This also happens when userspace did in fact request the AP stop, but that's not a problem. For full-MAC drivers this may need to be extended to also cover cases where the device stopped the AP operation for some reason, this a bit more complicated because then all cfg80211 state also needs to be reset; such API is not part of this patch. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9ed6ef6fd2c5..043bfbd58b56 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -11677,6 +11677,35 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
11677} 11677}
11678EXPORT_SYMBOL(cfg80211_crit_proto_stopped); 11678EXPORT_SYMBOL(cfg80211_crit_proto_stopped);
11679 11679
11680void nl80211_send_ap_stopped(struct wireless_dev *wdev)
11681{
11682 struct wiphy *wiphy = wdev->wiphy;
11683 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
11684 struct sk_buff *msg;
11685 void *hdr;
11686
11687 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
11688 if (!msg)
11689 return;
11690
11691 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_STOP_AP);
11692 if (!hdr)
11693 goto out;
11694
11695 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
11696 nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) ||
11697 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)))
11698 goto out;
11699
11700 genlmsg_end(msg, hdr);
11701
11702 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(wiphy), msg, 0,
11703 NL80211_MCGRP_MLME, GFP_KERNEL);
11704 return;
11705 out:
11706 nlmsg_free(msg);
11707}
11708
11680/* initialisation/exit functions */ 11709/* initialisation/exit functions */
11681 11710
11682int nl80211_init(void) 11711int nl80211_init(void)