Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153066707
D34496.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D34496.diff
View Options
Index: sys/net80211/ieee80211_freebsd.c
===================================================================
--- sys/net80211/ieee80211_freebsd.c
+++ sys/net80211/ieee80211_freebsd.c
@@ -35,6 +35,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/devctl.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/linker.h>
@@ -43,6 +44,7 @@
#include <sys/module.h>
#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
@@ -776,6 +778,62 @@
CURVNET_RESTORE();
}
+static void
+ieee80211_devctl_notify_assoc_status(struct ieee80211vap *vap,
+ struct ieee80211_node *ni, const char *status)
+{
+ struct sbuf sb;
+ const uint8_t *p;
+ int i, len;
+ bool printable;
+
+ if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL)
+ return;
+
+ sbuf_printf(&sb, "vap=%s", vap->iv_ifp->if_xname);
+
+ len = ni->ni_esslen;
+ printable = true;
+ for (i = 0, p = ni->ni_essid; i < len; i++, p++) {
+ if (*p < ' ' || *p > 0x7e) {
+ printable = false;
+ break;
+ }
+ }
+
+ if (printable) {
+ sbuf_printf(&sb, " ssid=\"");
+ devctl_safe_quote_sb_len(&sb, ni->ni_essid, ni->ni_esslen);
+ sbuf_printf(&sb, "\"");
+ } else {
+ sbuf_printf(&sb, " ssid=0x");
+ for (i = 0, p = ni->ni_essid; i < len; i++, p++) {
+ sbuf_printf(&sb, "%02x", *p);
+ }
+ }
+
+ sbuf_printf(&sb, " bssid=\"%s\"", ether_sprintf(ni->ni_bssid));
+ if (sbuf_finish(&sb) == 0)
+ devctl_notify("net80211", "sta", status, sbuf_data(&sb));
+ sbuf_delete(&sb);
+}
+
+void
+ieee80211_devctl_notify_assoc(struct ieee80211vap *vap,
+ struct ieee80211_node *ni)
+{
+
+ ieee80211_devctl_notify_assoc_status(vap, ni, "assoc");
+}
+
+void
+ieee80211_devctl_notify_disassoc(struct ieee80211vap *vap,
+ struct ieee80211_node *ni)
+{
+
+ ieee80211_devctl_notify_assoc_status(vap, ni, "disassoc");
+}
+
void
ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
{
Index: sys/net80211/ieee80211_node.c
===================================================================
--- sys/net80211/ieee80211_node.c
+++ sys/net80211/ieee80211_node.c
@@ -1036,6 +1036,7 @@
ieee80211_node_setuptxparms(ni);
ieee80211_ratectl_node_init(ni);
+ ieee80211_devctl_notify_assoc(vap, ni);
return ieee80211_sta_join1(ieee80211_ref_node(ni));
}
@@ -1050,6 +1051,7 @@
struct ieee80211com *ic = ni->ni_ic;
ic->ic_node_cleanup(ni);
+ ieee80211_devctl_notify_disassoc(ni->ni_vap, ni);
ieee80211_notify_node_leave(ni);
}
Index: sys/net80211/ieee80211_proto.h
===================================================================
--- sys/net80211/ieee80211_proto.h
+++ sys/net80211/ieee80211_proto.h
@@ -440,6 +440,10 @@
* Note that while these are defined here, their implementation
* is OS-specific.
*/
+void ieee80211_devctl_notify_assoc(struct ieee80211vap *vap,
+ struct ieee80211_node *ni);
+void ieee80211_devctl_notify_disassoc(struct ieee80211vap *vap,
+ struct ieee80211_node *ni);
void ieee80211_notify_node_join(struct ieee80211_node *, int newassoc);
void ieee80211_notify_node_leave(struct ieee80211_node *);
void ieee80211_notify_scan_done(struct ieee80211vap *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 10:34 PM (11 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31804975
Default Alt Text
D34496.diff (3 KB)
Attached To
Mode
D34496: kern: net80211: export sta assoc/disassoc via devctl
Attached
Detach File
Event Timeline
Log In to Comment