diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2011-03-23 09:29:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-30 14:15:18 -0400 |
commit | ec15e68ba6a505631016f230899bafbb7b8cd0d6 (patch) | |
tree | 21190a10af3c22ccd34b03f11088b5976ef3e34b | |
parent | cfdc9a8bb8d90c6aa212a5a881862599673c443d (diff) |
cfg80211: Add nl80211 event for deletion of a station entry
Indicate an NL80211_CMD_DEL_STATION event when a station entry in
mac80211 is deleted to match with the NL80211_CMD_NEW_STATION event
that is used when the entry was added. This is needed, e.g., to allow
user space to remove a peer from RSN IBSS Authenticator state machine
to avoid re-authentication and re-keying delays when the peer is not
reachable anymore.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/cfg80211.h | 9 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 | ||||
-rw-r--r-- | net/wireless/mlme.c | 9 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 34 | ||||
-rw-r--r-- | net/wireless/nl80211.h | 3 |
5 files changed, 57 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b2b9d28cb4ab..2c4530451721 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2667,6 +2667,15 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
2667 | struct station_info *sinfo, gfp_t gfp); | 2667 | struct station_info *sinfo, gfp_t gfp); |
2668 | 2668 | ||
2669 | /** | 2669 | /** |
2670 | * cfg80211_del_sta - notify userspace about deletion of a station | ||
2671 | * | ||
2672 | * @dev: the netdev | ||
2673 | * @mac_addr: the station's address | ||
2674 | * @gfp: allocation flags | ||
2675 | */ | ||
2676 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | ||
2677 | |||
2678 | /** | ||
2670 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | 2679 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
2671 | * @dev: network device | 2680 | * @dev: network device |
2672 | * @freq: Frequency on which the frame was received in MHz | 2681 | * @freq: Frequency on which the frame was received in MHz |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index d0311a322ddd..5ec0a7c51b6d 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -698,6 +698,8 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
698 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 698 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
699 | cancel_work_sync(&sta->drv_unblock_wk); | 699 | cancel_work_sync(&sta->drv_unblock_wk); |
700 | 700 | ||
701 | cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); | ||
702 | |||
701 | rate_control_remove_sta_debugfs(sta); | 703 | rate_control_remove_sta_debugfs(sta); |
702 | ieee80211_sta_debugfs_remove(sta); | 704 | ieee80211_sta_debugfs_remove(sta); |
703 | 705 | ||
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index aa5df8865ff7..16881fea4ce6 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -770,6 +770,15 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
770 | } | 770 | } |
771 | EXPORT_SYMBOL(cfg80211_new_sta); | 771 | EXPORT_SYMBOL(cfg80211_new_sta); |
772 | 772 | ||
773 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp) | ||
774 | { | ||
775 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | ||
776 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
777 | |||
778 | nl80211_send_sta_del_event(rdev, dev, mac_addr, gfp); | ||
779 | } | ||
780 | EXPORT_SYMBOL(cfg80211_del_sta); | ||
781 | |||
773 | struct cfg80211_mgmt_registration { | 782 | struct cfg80211_mgmt_registration { |
774 | struct list_head list; | 783 | struct list_head list; |
775 | 784 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4ebce4284e9d..40c90fb461c4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5966,6 +5966,40 @@ void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | |||
5966 | nl80211_mlme_mcgrp.id, gfp); | 5966 | nl80211_mlme_mcgrp.id, gfp); |
5967 | } | 5967 | } |
5968 | 5968 | ||
5969 | void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, | ||
5970 | struct net_device *dev, const u8 *mac_addr, | ||
5971 | gfp_t gfp) | ||
5972 | { | ||
5973 | struct sk_buff *msg; | ||
5974 | void *hdr; | ||
5975 | |||
5976 | msg = nlmsg_new(NLMSG_GOODSIZE, gfp); | ||
5977 | if (!msg) | ||
5978 | return; | ||
5979 | |||
5980 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DEL_STATION); | ||
5981 | if (!hdr) { | ||
5982 | nlmsg_free(msg); | ||
5983 | return; | ||
5984 | } | ||
5985 | |||
5986 | NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); | ||
5987 | NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); | ||
5988 | |||
5989 | if (genlmsg_end(msg, hdr) < 0) { | ||
5990 | nlmsg_free(msg); | ||
5991 | return; | ||
5992 | } | ||
5993 | |||
5994 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | ||
5995 | nl80211_mlme_mcgrp.id, gfp); | ||
5996 | return; | ||
5997 | |||
5998 | nla_put_failure: | ||
5999 | genlmsg_cancel(msg, hdr); | ||
6000 | nlmsg_free(msg); | ||
6001 | } | ||
6002 | |||
5969 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | 6003 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, |
5970 | struct net_device *netdev, u32 nlpid, | 6004 | struct net_device *netdev, u32 nlpid, |
5971 | int freq, const u8 *buf, size_t len, gfp_t gfp) | 6005 | int freq, const u8 *buf, size_t len, gfp_t gfp) |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index e3f7fa886966..dcac5cd6f017 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -79,6 +79,9 @@ void nl80211_send_remain_on_channel_cancel( | |||
79 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | 79 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, |
80 | struct net_device *dev, const u8 *mac_addr, | 80 | struct net_device *dev, const u8 *mac_addr, |
81 | struct station_info *sinfo, gfp_t gfp); | 81 | struct station_info *sinfo, gfp_t gfp); |
82 | void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, | ||
83 | struct net_device *dev, const u8 *mac_addr, | ||
84 | gfp_t gfp); | ||
82 | 85 | ||
83 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | 86 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, |
84 | struct net_device *netdev, u32 nlpid, int freq, | 87 | struct net_device *netdev, u32 nlpid, int freq, |