summaryrefslogtreecommitdiff
path: root/ubus.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-10-17 16:51:49 +0200
committerSteven Barth <steven@midlink.org>2013-10-17 16:51:49 +0200
commit81a3b50ef7fad3096a8d164c871521e6e6b55aa1 (patch)
treee1f1c5bd0e6ea41c98f2dcc11429d8eece78fdf3 /ubus.c
parent266d92dd83bd5bfe520f3e2838794bf9bb827c07 (diff)
downloadnetifd-81a3b50ef7fad3096a8d164c871521e6e6b55aa1.tar.gz
Add protocol update notifications and hotplug legacy calls
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ubus.c b/ubus.c
index d245541..a26c3dd 100644
--- a/ubus.c
+++ b/ubus.c
@@ -630,7 +630,6 @@ netifd_dump_status(struct interface *iface)
struct device *dev;
void *a, *inactive;
- blobmsg_add_string(&b, "name", iface->name);
blobmsg_add_u8(&b, "up", iface->state == IFS_UP);
blobmsg_add_u8(&b, "pending", iface->state == IFS_SETUP);
blobmsg_add_u8(&b, "available", iface->available);
@@ -739,6 +738,7 @@ netifd_handle_dump(struct ubus_context *ctx, struct ubus_object *obj,
struct interface *iface;
vlist_for_each_element(&interfaces, iface, node) {
void *i = blobmsg_open_table(&b, NULL);
+ blobmsg_add_string(&b, "interface", iface->name);
netifd_dump_status(iface);
blobmsg_close_table(&b, i);
}
@@ -997,6 +997,17 @@ netifd_ubus_interface_event(struct interface *iface, bool up)
}
void
+netifd_ubus_interface_notify(struct interface *iface, bool up)
+{
+ const char *event = (up) ? "update" : "down";
+ blob_buf_init(&b, 0);
+ blobmsg_add_string(&b, "interface", iface->name);
+ netifd_dump_status(iface);
+ ubus_notify(ctx, &iface_object, event, b.head, -1);
+ ubus_notify(ctx, &iface->ubus, event, b.head, -1);
+}
+
+void
netifd_ubus_add_interface(struct interface *iface)
{
struct ubus_object *obj = &iface->ubus;