summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2024-09-18 15:05:34 +0200
committerJohn Crispin <john@phrozen.org>2024-10-02 15:19:42 +0200
commit3ed5f6430b0f07116fabc3d45e5ee1cb7280f6d2 (patch)
treede3515d96bd0846f2d14b31b7ef89e11c4bb112f
parentdd62f7659b38602dfbefc8894a66c13930b872d1 (diff)
downloadopenwrt-3ed5f6430b0f07116fabc3d45e5ee1cb7280f6d2.tar.gz
openwrt-3ed5f6430b0f07116fabc3d45e5ee1cb7280f6d2.tar.bz2
openwrt-3ed5f6430b0f07116fabc3d45e5ee1cb7280f6d2.zip
hostapd: send a notification via ubus when CSA completed
Signed-off-by: John Crispin <john@phrozen.org>
-rw-r--r--package/network/services/hostapd/patches/600-ubus_support.patch8
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.c13
-rw-r--r--package/network/services/hostapd/src/src/ap/ubus.h6
3 files changed, 27 insertions, 0 deletions
diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
index fb3bfb0120..256d1cfcc4 100644
--- a/package/network/services/hostapd/patches/600-ubus_support.patch
+++ b/package/network/services/hostapd/patches/600-ubus_support.patch
@@ -116,6 +116,14 @@ probe/assoc/auth requests via object subscribe.
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
+@@ -1369,6 +1379,7 @@ void hostapd_event_ch_switch(struct host
+
+ wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED
+ "freq=%d dfs=%d", freq, is_dfs);
++ hostapd_ubus_notify_csa(hapd, freq);
+ } else if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) {
+ /* Complete AP configuration for the first bring up. */
+ if (is_dfs0 > 0 &&
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -475,6 +475,7 @@ void hostapd_free_hapd_data(struct hosta
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index 4dda2b0571..2256720755 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -2024,3 +2024,16 @@ void hostapd_ubus_notify_apup_newpeer(
ubus_notify(ctx, &hapd->ubus.obj, "apup-newpeer", b.head, -1);
}
#endif // def CONFIG_APUP
+
+void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq)
+{
+ if (!hapd->ubus.obj.has_subscribers)
+ return;
+
+ blob_buf_init(&b, 0);
+ blobmsg_add_string(&b, "ifname", hapd->conf->iface);
+ blobmsg_add_u32(&b, "freq", freq);
+ blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid));
+
+ ubus_notify(ctx, &hapd->ubus.obj, "channel-switch", b.head, -1);
+}
diff --git a/package/network/services/hostapd/src/src/ap/ubus.h b/package/network/services/hostapd/src/src/ap/ubus.h
index 5c03cb90ad..055a18c092 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.h
+++ b/package/network/services/hostapd/src/src/ap/ubus.h
@@ -68,6 +68,7 @@ int hostapd_ubus_notify_bss_transition_query(
const u8 *candidate_list, u16 candidate_list_len);
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
const char *auth_alg);
+void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq);
#ifdef CONFIG_APUP
void hostapd_ubus_notify_apup_newpeer(
@@ -155,6 +156,11 @@ hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
{
}
+static inline void
+hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq)
+{
+}
+
#endif
#endif