openwrt/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch
Felix Fietkau 127078567b hostapd: improve ucode bss notifications
Reduce code duplication, add extra callback for bss create

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-21 18:32:26 +02:00

71 lines
2.0 KiB
Diff

From aaeb60b39a72774c651187208ec47efd0daeb75b Mon Sep 17 00:00:00 2001
From: Gioacchino Mazzurco <gio@polymathes.cc>
Date: Tue, 7 May 2024 11:54:23 +0200
Subject: [PATCH 3/3] APuP add ucode hook for when a peer comes up
Signed-off-by: Gioacchino Mazzurco <gio@polymathes.cc>
---
src/ap/apup.c | 8 ++++++++
src/ap/ucode.c | 17 +++++++++++++++++
src/ap/ucode.h | 4 ++++
3 files changed, 29 insertions(+)
--- a/src/ap/apup.c
+++ b/src/ap/apup.c
@@ -27,6 +27,10 @@
# include "ubus.h"
#endif
+#ifdef UCODE_SUPPORT
+# include "ucode.h"
+#endif
+
void apup_process_beacon(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len,
const struct ieee802_11_elems *elems )
@@ -157,4 +161,8 @@ void apup_process_beacon(struct hostapd_
#ifdef UBUS_SUPPORT
hostapd_ubus_notify_apup_newpeer(hapd, mgmt->bssid, mIfname);
#endif
+
+#ifdef UCODE_SUPPORT
+ hostapd_ucode_apup_newpeer(hapd, mIfname);
+#endif
}
--- a/src/ap/ucode.c
+++ b/src/ap/ucode.c
@@ -802,3 +802,20 @@ void hostapd_ucode_free_bss(struct hosta
ucv_put(wpa_ucode_call(2));
ucv_gc(vm);
}
+
+#ifdef CONFIG_APUP
+void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname)
+{
+ uc_value_t *val;
+
+ if (wpa_ucode_call_prepare("apup_newpeer"))
+ return;
+
+ val = hostapd_ucode_bss_get_uval(hapd);
+ uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); // BSS ifname
+ uc_value_push(ucv_get(val));
+ uc_value_push(ucv_get(ucv_string_new(ifname))); // APuP peer ifname
+ ucv_put(wpa_ucode_call(2));
+ ucv_gc(vm);
+}
+#endif // def CONFIG_APUP
--- a/src/ap/ucode.h
+++ b/src/ap/ucode.h
@@ -26,6 +26,10 @@ void hostapd_ucode_free_iface(struct hos
void hostapd_ucode_free_bss(struct hostapd_data *hapd);
void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type);
+#ifdef CONFIG_APUP
+void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname);
+#endif // def CONFIG_APUP
+
#else
static inline int hostapd_ucode_init(struct hapd_interfaces *ifaces)