hostapd: fold extra APuP patches into main patch + src/
authorFelix Fietkau <nbd@nbd.name>
Wed, 18 Sep 2024 16:10:25 +0000 (18:10 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 21 Sep 2024 16:33:52 +0000 (18:33 +0200)
Simplifies maintenance

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/patches/780-Implement-APuP-Access-Point-Micro-Peering.patch
package/network/services/hostapd/patches/790-APuP-add-ubus-notification-when-a-peer-comes-up.patch [deleted file]
package/network/services/hostapd/patches/800-APuP-add-ucode-hook-for-when-a-peer-comes-up.patch [deleted file]
package/network/services/hostapd/src/src/ap/ubus.c
package/network/services/hostapd/src/src/ap/ubus.h
package/network/services/hostapd/src/src/ap/ucode.c
package/network/services/hostapd/src/src/ap/ucode.h

index e72864efa1c673d4890aab9f808334df873f080b..157b7dbb82302e02a37e1c9f8dc7a0b63f67ad5d 100644 (file)
@@ -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 (file)
index 1efec5f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-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 {};
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 (file)
index a4e2fe8..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-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)
index 8689494bcff3e515c325a02b90cfe6913a35936c..f21516fc3c78ac976008bae2032436929270f6fe 100644 (file)
@@ -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
index 5b8938cbd32d7dd30ddb1ad835b4a4536ee0bf3f..5c03cb90ad75b8c1841c96c1db0c8f39ea62a309 100644 (file)
@@ -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 {};
index 751531d5a14ae9829d0b8c3b57dc08a39fa41c43..2c1e706804df56b6ef7cf7dfd40d7646ffa25049 100644 (file)
@@ -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
index 53aa1f3e7fd166d88377b13295ca4c50c66a5238..2f7bcd6542a2362e8134c3d040091a4e5b9d46e2 100644 (file)
@@ -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)