--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -5202,6 +5202,15 @@ static int hostapd_config_fill(struct ho
+@@ -5200,6 +5200,15 @@ static int hostapd_config_fill(struct ho
bss->mld_indicate_disabled = atoi(pos);
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_IEEE80211BE */
"Line %d: unknown configuration item '%s'",
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1000,6 +1000,35 @@ struct hostapd_bss_config {
+@@ -999,6 +999,35 @@ struct hostapd_bss_config {
bool mld_indicate_disabled;
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_IEEE80211BE */
int hostapd_sta_add(struct hostapd_data *hapd,
--- /dev/null
+++ b/src/ap/apup.c
-@@ -0,0 +1,152 @@
+@@ -0,0 +1,168 @@
+/*
+ * hostapd / APuP Access Point Micro Peering
+ *
+#include "ap_drv_ops.h"
+#include "sta_info.h"
+
++#ifdef UBUS_SUPPORT
++# 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 )
+ "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
++
++#ifdef UCODE_SUPPORT
++ hostapd_ucode_apup_newpeer(hapd, mIfname);
++#endif
+}
--- /dev/null
+++ b/src/ap/apup.h
#ifdef CONFIG_FILS
static struct wpabuf *
-@@ -3588,8 +3591,8 @@ static u16 check_multi_ap(struct hostapd
+@@ -3615,8 +3618,8 @@ static u16 check_multi_ap(struct hostapd
}
{
/* Supported rates not used in IEEE 802.11ad/DMG */
if (hapd->iface->current_mode &&
-@@ -3976,7 +3979,7 @@ static int __check_assoc_ies(struct host
+@@ -4003,7 +4006,7 @@ static int __check_assoc_ies(struct host
elems->ext_capab_len);
if (resp != WLAN_STATUS_SUCCESS)
return resp;
if (resp != WLAN_STATUS_SUCCESS)
return resp;
-@@ -6031,6 +6034,11 @@ static void handle_beacon(struct hostapd
+@@ -6058,6 +6061,11 @@ static void handle_beacon(struct hostapd
0);
ap_list_process_beacon(hapd->iface, mgmt, &elems, fi);
+++ /dev/null
-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
-@@ -69,6 +69,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 {};
+++ /dev/null
-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)
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
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 {};
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
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)