aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJavier Cardona <javier@cozybit.com>2011-04-07 18:08:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-12 16:57:39 -0400
commitc93b5e717ec47b57abfe0229360bc11e77520984 (patch)
tree1e6f703c3c1b1c2e55b759b4e992ef04e81f973e /net/wireless
parent96b78dff0321d881ef27d858a462c476e0444619 (diff)
nl80211: New notification to discover mesh peer candidates.
Notify userspace when a beacon/presp is received from a suitable mesh peer candidate for whom no sta information exists. Userspace can then decide to create a sta info for the candidate. If userspace is not ready to authenticate the peer right away, it can create the sta info with the authenticated flag unset and set it later. Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/mesh.c14
-rw-r--r--net/wireless/nl80211.c38
-rw-r--r--net/wireless/nl80211.h4
3 files changed, 56 insertions, 0 deletions
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index e0226e8265a3..5c116083eeca 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -1,5 +1,6 @@
1#include <linux/ieee80211.h> 1#include <linux/ieee80211.h>
2#include <net/cfg80211.h> 2#include <net/cfg80211.h>
3#include "nl80211.h"
3#include "core.h" 4#include "core.h"
4 5
5/* Default values, timeouts in ms */ 6/* Default values, timeouts in ms */
@@ -110,6 +111,19 @@ int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
110 return err; 111 return err;
111} 112}
112 113
114void cfg80211_notify_new_peer_candidate(struct net_device *dev,
115 const u8 *macaddr, const u8* ie, u8 ie_len, gfp_t gfp)
116{
117 struct wireless_dev *wdev = dev->ieee80211_ptr;
118
119 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_MESH_POINT))
120 return;
121
122 nl80211_send_new_peer_candidate(wiphy_to_dev(wdev->wiphy), dev,
123 macaddr, ie, ie_len, gfp);
124}
125EXPORT_SYMBOL(cfg80211_notify_new_peer_candidate);
126
113static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 127static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
114 struct net_device *dev) 128 struct net_device *dev)
115{ 129{
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f4cb8efe2e5f..58f501a35022 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5818,6 +5818,44 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
5818 nlmsg_free(msg); 5818 nlmsg_free(msg);
5819} 5819}
5820 5820
5821void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev,
5822 struct net_device *netdev,
5823 const u8 *macaddr, const u8* ie, u8 ie_len,
5824 gfp_t gfp)
5825{
5826 struct sk_buff *msg;
5827 void *hdr;
5828
5829 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
5830 if (!msg)
5831 return;
5832
5833 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NEW_PEER_CANDIDATE);
5834 if (!hdr) {
5835 nlmsg_free(msg);
5836 return;
5837 }
5838
5839 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
5840 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
5841 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, macaddr);
5842 if (ie_len && ie)
5843 NLA_PUT(msg, NL80211_ATTR_IE, ie_len , ie);
5844
5845 if (genlmsg_end(msg, hdr) < 0) {
5846 nlmsg_free(msg);
5847 return;
5848 }
5849
5850 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
5851 nl80211_mlme_mcgrp.id, gfp);
5852 return;
5853
5854 nla_put_failure:
5855 genlmsg_cancel(msg, hdr);
5856 nlmsg_free(msg);
5857}
5858
5821void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, 5859void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
5822 struct net_device *netdev, const u8 *addr, 5860 struct net_device *netdev, const u8 *addr,
5823 enum nl80211_key_type key_type, int key_id, 5861 enum nl80211_key_type key_type, int key_id,
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index dcac5cd6f017..f2af6955a665 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -50,6 +50,10 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
50 struct net_device *netdev, u16 reason, 50 struct net_device *netdev, u16 reason,
51 const u8 *ie, size_t ie_len, bool from_ap); 51 const u8 *ie, size_t ie_len, bool from_ap);
52 52
53void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev,
54 struct net_device *netdev,
55 const u8 *macaddr, const u8* ie, u8 ie_len,
56 gfp_t gfp);
53void 57void
54nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, 58nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
55 struct net_device *netdev, const u8 *addr, 59 struct net_device *netdev, const u8 *addr,