openwrt/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch
Ivan Pavlov da11a1e20c hostapd: update to version 2024-09-15
Remove upstreamed from 2.11 release:
  060-nl80211-fix-crash-when-adding-an-interface-fails.patch

Rebase all other patches

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16338
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-09-16 10:32:43 +02:00

73 lines
2.1 KiB
Diff

From 9a265f70b5e4e048c568564aed5f9ac4a4fd76b0 Mon Sep 17 00:00:00 2001
From: Gioacchino Mazzurco <gio@polymathes.cc>
Date: Tue, 7 May 2024 10:37:54 +0200
Subject: [PATCH 2/3] APuP add ubus notification when a peer comes up
The notification ones get looks like
{ "apup-newpeer": {"address":"02:0a:ab:45:5a:ab","ifname":"wlan0.peer1"} }
Signed-off-by: Gioacchino Mazzurco <gio@polymathes.cc>
---
src/ap/apup.c | 8 ++++++++
src/ap/ubus.c | 15 +++++++++++++++
src/ap/ubus.h | 5 +++++
3 files changed, 28 insertions(+)
--- a/src/ap/apup.c
+++ b/src/ap/apup.c
@@ -23,6 +23,10 @@
#include "ap_drv_ops.h"
#include "sta_info.h"
+#ifdef UBUS_SUPPORT
+# include "ubus.h"
+#endif
+
void apup_process_beacon(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len,
const struct ieee802_11_elems *elems )
@@ -149,4 +153,8 @@ void apup_process_beacon(struct hostapd_
"apup_process_beacon(...) Added APuP peer at %s with flags: %d,"
" capabilities %d",
mIfname, sta_ret->flags, sta_ret->capability);
+
+#ifdef UBUS_SUPPORT
+ hostapd_ubus_notify_apup_newpeer(hapd, mgmt->bssid, mIfname);
+#endif
}
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -2004,3 +2004,18 @@ int hostapd_ubus_notify_bss_transition_q
return ureq.resp;
#endif
}
+
+#ifdef CONFIG_APUP
+void hostapd_ubus_notify_apup_newpeer(
+ struct hostapd_data *hapd, const u8 *addr, const char *ifname)
+{
+ if (!hapd->ubus.obj.has_subscribers)
+ return;
+
+ blob_buf_init(&b, 0);
+ blobmsg_add_macaddr(&b, "address", addr);
+ blobmsg_add_string(&b, "ifname", ifname);
+
+ ubus_notify(ctx, &hapd->ubus.obj, "apup-newpeer", b.head, -1);
+}
+#endif // def CONFIG_APUP
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -71,6 +71,11 @@ int hostapd_ubus_notify_bss_transition_q
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
const char *auth_alg);
+#ifdef CONFIG_APUP
+void hostapd_ubus_notify_apup_newpeer(
+ struct hostapd_data *hapd, const u8 *addr, const char *ifname);
+#endif // def CONFIG_APUP
+
#else
struct hostapd_ubus_bss {};