From: Felix Fietkau Date: Wed, 18 Sep 2024 16:10:25 +0000 (+0200) Subject: hostapd: fold extra APuP patches into main patch + src/ X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1a288670d99012e2921c2a8906e7a61dc8e89e72;p=openwrt%2Fstaging%2Fthess.git hostapd: fold extra APuP patches into main patch + src/ Simplifies maintenance Signed-off-by: Felix Fietkau --- diff --git a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch index e72864efa1..157b7dbb82 100644 --- a/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch +++ b/package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch @@ -53,7 +53,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 --- 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 */ @@ -71,7 +71,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 "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 */ @@ -164,7 +164,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 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 + * @@ -190,6 +190,14 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 +#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 ) @@ -316,6 +324,14 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 + "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 @@ -356,7 +372,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 #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 } @@ -367,7 +383,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 { /* 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; @@ -376,7 +392,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6 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); diff --git a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch deleted file mode 100644 index 1efec5f806..0000000000 --- a/package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 9a265f70b5e4e048c568564aed5f9ac4a4fd76b0 Mon Sep 17 00:00:00 2001 -From: Gioacchino Mazzurco -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 ---- - 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 {}; diff --git a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch b/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch deleted file mode 100644 index a4e2fe827b..0000000000 --- a/package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch +++ /dev/null @@ -1,70 +0,0 @@ -From aaeb60b39a72774c651187208ec47efd0daeb75b Mon Sep 17 00:00:00 2001 -From: Gioacchino Mazzurco -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 ---- - 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) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 8689494bcf..f21516fc3c 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -2004,3 +2004,18 @@ int hostapd_ubus_notify_bss_transition_query( 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 diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h index 5b8938cbd3..5c03cb90ad 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.h +++ b/package/network/services/hostapd/src/src/ap/ubus.h @@ -69,6 +69,11 @@ int hostapd_ubus_notify_bss_transition_query( 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 {}; diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 751531d5a1..2c1e706804 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -802,3 +802,20 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd) 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 diff --git a/package/network/services/hostapd/src/src/ap/ucode.h b/package/network/services/hostapd/src/src/ap/ucode.h index 53aa1f3e7f..2f7bcd6542 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.h +++ b/package/network/services/hostapd/src/src/ap/ucode.h @@ -26,6 +26,10 @@ void hostapd_ucode_free_iface(struct hostapd_iface *iface); 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)