summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2019-10-25 14:02:03 +0200
committerDaniel Golle <daniel@makrotopia.org>2019-10-25 14:07:01 +0200
commit7a723d0c797d28823f3d0eae9c72aca3ae69d976 (patch)
tree9d4e99060da054dac84dbe8215f000979ce395f1 /ubus.c
parent5e02f94411b06f192fb2a7d9be9abde3549153a8 (diff)
wireless: add ubus method for reloading configuration
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ubus.c b/ubus.c
index 150d818..5a2a339 100644
--- a/ubus.c
+++ b/ubus.c
@@ -1082,6 +1082,28 @@ get_wdev(struct blob_attr *msg, int *ret)
}
static int
+netifd_handle_wdev_reconf(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct wireless_device *wdev;
+ int ret;
+
+ wdev = get_wdev(msg, &ret);
+ if (ret == UBUS_STATUS_NOT_FOUND)
+ return ret;
+
+ if (wdev) {
+ wireless_device_reconf(wdev);
+ } else {
+ vlist_for_each_element(&wireless_devices, wdev, node)
+ wireless_device_reconf(wdev);
+ }
+
+ return 0;
+}
+
+static int
netifd_handle_wdev_up(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
@@ -1189,6 +1211,7 @@ netifd_handle_wdev_notify(struct ubus_context *ctx, struct ubus_object *obj,
static struct ubus_method wireless_object_methods[] = {
{ .name = "up", .handler = netifd_handle_wdev_up },
{ .name = "down", .handler = netifd_handle_wdev_down },
+ { .name = "reconf", .handler = netifd_handle_wdev_reconf },
{ .name = "status", .handler = netifd_handle_wdev_status },
{ .name = "notify", .handler = netifd_handle_wdev_notify },
{ .name = "get_validate", .handler = netifd_handle_wdev_get_validate },