From 5c72ebc9153b53cd8ebd997f2eb7e37306e9dbb2 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 7 Sep 2024 18:05:48 +0200 Subject: [PATCH] ubus: support readiness notifications Signed-off-by: Raito Bezarius --- src/ap/hostapd.c | 2 ++ src/ap/ubus.c | 10 ++++++++++ src/ap/ubus.h | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index e550b13c1..0e54d0f68 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2676,6 +2676,8 @@ dfs_offload: #endif /* CONFIG_FST */ hostapd_set_state(iface, HAPD_IFACE_ENABLED); + // TODO: log everything in `hostapd_set_state` directly + hostapd_ubus_notify_readiness(hapd); hostapd_owe_update_trans(iface); airtime_policy_update_init(iface); wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED); diff --git a/src/ap/ubus.c b/src/ap/ubus.c index 9e061284a..ebfeeacaa 100644 --- a/src/ap/ubus.c +++ b/src/ap/ubus.c @@ -1855,6 +1855,16 @@ void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 * ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); } +void hostapd_ubus_notify_readiness(struct hostapd_data *hapd) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + blob_buf_init(&b, 0); + + ubus_notify(ctx, &hapd->ubus.obj, "readiness", b.head, -1); +} + void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, const char *auth_alg) { diff --git a/src/ap/ubus.h b/src/ap/ubus.h index 22767d67e..f8f2ae33a 100644 --- a/src/ap/ubus.h +++ b/src/ap/ubus.h @@ -70,6 +70,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_readiness(struct hostapd_data *hapd); #else @@ -112,6 +113,10 @@ static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *ty { } +static inline void hostapd_ubus_notify_readiness(struct hostapd_data *hapd) +{ +} + static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, const u8 *addr, u8 token, u8 rep_mode,