From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH next 15/18] mac80211/cfg80211: add station events
Date: Wed, 23 Dec 2009 13:15:44 +0100 [thread overview]
Message-ID: <20091223121617.798148880@sipsolutions.net> (raw)
In-Reply-To: 20091223121529.289129599@sipsolutions.net
When, for instance, a new IBSS peer is found, userspace
wants to be notified. Add events for all new stations
that mac80211 learns about.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/net/cfg80211.h | 12 ++++++++++++
net/mac80211/sta_info.c | 5 +++++
net/wireless/mlme.c | 10 ++++++++++
net/wireless/nl80211.c | 21 ++++++++++++++++++++-
net/wireless/nl80211.h | 4 ++++
5 files changed, 51 insertions(+), 1 deletion(-)
--- wireless-testing.orig/net/wireless/mlme.c 2009-12-23 13:11:25.000000000 +0100
+++ wireless-testing/net/wireless/mlme.c 2009-12-23 13:11:27.000000000 +0100
@@ -718,3 +718,13 @@ void cfg80211_remain_on_channel_expired(
channel_type, gfp);
}
EXPORT_SYMBOL(cfg80211_remain_on_channel_expired);
+
+void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
+ struct station_info *sinfo, gfp_t gfp)
+{
+ struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+
+ nl80211_send_sta_event(rdev, dev, mac_addr, sinfo, gfp);
+}
+EXPORT_SYMBOL(cfg80211_new_sta);
--- wireless-testing.orig/net/wireless/nl80211.c 2009-12-23 13:11:25.000000000 +0100
+++ wireless-testing/net/wireless/nl80211.c 2009-12-23 13:11:27.000000000 +0100
@@ -1642,7 +1642,7 @@ static int parse_station_flags(struct ge
static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
int flags, struct net_device *dev,
- u8 *mac_addr, struct station_info *sinfo)
+ const u8 *mac_addr, struct station_info *sinfo)
{
void *hdr;
struct nlattr *sinfoattr, *txrate;
@@ -5356,6 +5356,25 @@ void nl80211_send_remain_on_channel_canc
channel_type, 0, gfp);
}
+void nl80211_send_sta_event(struct cfg80211_registered_device *rdev,
+ struct net_device *dev, const u8 *mac_addr,
+ struct station_info *sinfo, gfp_t gfp)
+{
+ struct sk_buff *msg;
+
+ msg = nlmsg_new(NLMSG_GOODSIZE, gfp);
+ if (!msg)
+ return;
+
+ if (nl80211_send_station(msg, 0, 0, 0, dev, mac_addr, sinfo) < 0) {
+ nlmsg_free(msg);
+ return;
+ }
+
+ genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+ nl80211_mlme_mcgrp.id, gfp);
+}
+
/* initialisation/exit functions */
int nl80211_init(void)
--- wireless-testing.orig/net/wireless/nl80211.h 2009-12-23 13:11:25.000000000 +0100
+++ wireless-testing/net/wireless/nl80211.h 2009-12-23 13:11:27.000000000 +0100
@@ -70,4 +70,8 @@ void nl80211_send_remain_on_channel_canc
u64 cookie, struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type, gfp_t gfp);
+void nl80211_send_sta_event(struct cfg80211_registered_device *rdev,
+ struct net_device *dev, const u8 *mac_addr,
+ struct station_info *sinfo, gfp_t gfp);
+
#endif /* __NET_WIRELESS_NL80211_H */
--- wireless-testing.orig/include/net/cfg80211.h 2009-12-23 13:11:25.000000000 +0100
+++ wireless-testing/include/net/cfg80211.h 2009-12-23 13:11:27.000000000 +0100
@@ -2195,4 +2195,16 @@ void cfg80211_remain_on_channel_expired(
enum nl80211_channel_type channel_type,
gfp_t gfp);
+
+/**
+ * cfg80211_new_sta - notify userspace about station
+ *
+ * @dev: the netdev
+ * @mac_addr: the station's address
+ * @sinfo: the station information
+ * @gfp: allocation flags
+ */
+void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
+ struct station_info *sinfo, gfp_t gfp);
+
#endif /* __NET_CFG80211_H */
--- wireless-testing.orig/net/mac80211/sta_info.c 2009-12-23 13:11:13.000000000 +0100
+++ wireless-testing/net/mac80211/sta_info.c 2009-12-23 13:11:27.000000000 +0100
@@ -359,6 +359,7 @@ int sta_info_insert(struct sta_info *sta
{
struct ieee80211_local *local = sta->local;
struct ieee80211_sub_if_data *sdata = sta->sdata;
+ struct station_info sinfo;
unsigned long flags;
int err = 0;
@@ -408,6 +409,10 @@ int sta_info_insert(struct sta_info *sta
spin_unlock_irqrestore(&local->sta_lock, flags);
+ sinfo.filled = 0;
+ sinfo.generation = local->sta_generation;
+ cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_ATOMIC);
+
#ifdef CONFIG_MAC80211_DEBUGFS
/*
* Debugfs entry adding might sleep, so schedule process
next prev parent reply other threads:[~2009-12-23 12:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 12:15 [PATCH next 00/18] wireless features Johannes Berg
2009-12-23 12:15 ` [PATCH next 01/18] ar9170: load firmware asynchronously Johannes Berg
2009-12-23 12:15 ` [PATCH next 02/18] mac80211: add ieee80211_sdata_running Johannes Berg
2009-12-23 12:15 ` [PATCH next 03/18] mac80211: introduce flush operation Johannes Berg
2009-12-23 12:15 ` [PATCH next 04/18] mac80211: let cfg80211 manage auth state Johannes Berg
2009-12-23 12:15 ` [PATCH next 05/18] mac80211: generalise management work a bit Johannes Berg
2009-12-23 12:15 ` [PATCH next 06/18] mac80211: generalise work handling Johannes Berg
2009-12-23 12:15 ` [PATCH next 07/18] mac80211: rewrite a few work messages Johannes Berg
2009-12-23 12:15 ` [PATCH next 08/18] mac80211: refactor association Johannes Berg
2009-12-23 12:15 ` [PATCH next 09/18] mac80211: split up and insert custom IEs correctly Johannes Berg
2009-12-23 12:15 ` [PATCH next 10/18] mac80211: proper bss private data handling Johannes Berg
2009-12-23 12:15 ` [PATCH next 11/18] mac80211: Generalize off-channel operation helpers from scan code Johannes Berg
2009-12-23 12:15 ` [PATCH next 12/18] cfg80211: add remain-on-channel command Johannes Berg
2009-12-23 12:15 ` [PATCH next 13/18] mac80211: support " Johannes Berg
2009-12-23 12:15 ` [PATCH next 14/18] mac80211: make off-channel work generic Johannes Berg
2009-12-23 12:15 ` Johannes Berg [this message]
2009-12-23 12:15 ` [PATCH next 16/18] mac80211: remove struct ieee80211_if_init_conf Johannes Berg
2009-12-23 12:15 ` [PATCH next 17/18] mac80211: remove requeue from work Johannes Berg
2009-12-23 12:15 ` [PATCH next 18/18] [PATCH] mac80211: annotate sleeping driver ops Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091223121617.798148880@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.