mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-13 16:31:09 +00:00
hostapd: send ubus event on BSS update
hostapd will emit a ubus event with the eventname hostapd.<ifname>.<event> when adding, removing or reloading a BSS. This way, services which install state (for example the RMM neighbor list) can on-demand reinstall this information for the BSS without polling this state. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
ec80139629
commit
6254af0c37
@ -7,7 +7,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=hostapd
|
PKG_NAME:=hostapd
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
|
|
||||||
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
|
@ -108,6 +108,21 @@ void hostapd_ubus_free_iface(struct hostapd_iface *iface)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hostapd_send_ubus_event(char *bssname, char *event)
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
if (!ctx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
blob_buf_init(&b, 0);
|
||||||
|
ubus_send_event(ctx, name, b.head);
|
||||||
|
free(name);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hostapd_bss_del_ban(void *eloop_data, void *user_ctx)
|
hostapd_bss_del_ban(void *eloop_data, void *user_ctx)
|
||||||
{
|
{
|
||||||
@ -152,7 +167,10 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
struct blob_attr *msg)
|
struct blob_attr *msg)
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||||
return hostapd_reload_config(hapd->iface, 1);
|
int ret = hostapd_reload_config(hapd->iface, 1);
|
||||||
|
|
||||||
|
hostapd_send_ubus_event(hapd->conf->iface, "reload");
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1086,6 +1104,8 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd)
|
|||||||
obj->n_methods = bss_object_type.n_methods;
|
obj->n_methods = bss_object_type.n_methods;
|
||||||
ret = ubus_add_object(ctx, obj);
|
ret = ubus_add_object(ctx, obj);
|
||||||
hostapd_ubus_ref_inc();
|
hostapd_ubus_ref_inc();
|
||||||
|
|
||||||
|
hostapd_send_ubus_event(hapd->conf->iface, "add");
|
||||||
}
|
}
|
||||||
|
|
||||||
void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
||||||
@ -1096,6 +1116,8 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
|
|||||||
if (!ctx)
|
if (!ctx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
hostapd_send_ubus_event(hapd->conf->iface, "remove");
|
||||||
|
|
||||||
if (obj->id) {
|
if (obj->id) {
|
||||||
ubus_remove_object(ctx, obj);
|
ubus_remove_object(ctx, obj);
|
||||||
hostapd_ubus_ref_dec();
|
hostapd_ubus_ref_dec();
|
||||||
|
Loading…
Reference in New Issue
Block a user