summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2017-04-12 19:53:20 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2017-04-22 23:37:36 +0200
commit11cb9cfbb088740ee7ee5e6c6b661958c0f962cb (patch)
tree7d6740bffa2b9a8f05983d8a5dc79bedc73e7dc6 /ubus.c
parent4375d1bc56301dd977ab102db995e07aa930d4a2 (diff)
ubus: add interface method to trigger renew event
Not all topology or connectivity changes may be detected by netifd, depending on the underlying technology (e.g. VPN software); this adds a way to explicitly trigger a renew. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ubus.c b/ubus.c
index 945eca1..6f7c3e1 100644
--- a/ubus.c
+++ b/ubus.c
@@ -378,6 +378,19 @@ netifd_handle_down(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
+static int
+netifd_handle_renew(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ struct interface *iface;
+
+ iface = container_of(obj, struct interface, ubus);
+ interface_renew(iface);
+
+ return 0;
+}
+
static void
netifd_add_interface_errors(struct blob_buf *b, struct interface *iface)
{
@@ -914,6 +927,7 @@ netifd_handle_set_data(struct ubus_context *ctx, struct ubus_object *obj,
static struct ubus_method iface_object_methods[] = {
{ .name = "up", .handler = netifd_handle_up },
{ .name = "down", .handler = netifd_handle_down },
+ { .name = "renew", .handler = netifd_handle_renew },
{ .name = "status", .handler = netifd_handle_status },
{ .name = "prepare", .handler = netifd_handle_iface_prepare },
{ .name = "dump", .handler = netifd_handle_dump },