84 lines
3.0 KiB
Diff
84 lines
3.0 KiB
Diff
|
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
||
|
Date: Wed, 12 Apr 2017 02:31:12 +0200
|
||
|
Subject: netifd: ubus: add interface method to trigger renew event
|
||
|
|
||
|
diff --git a/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch b/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch
|
||
|
new file mode 100644
|
||
|
index 0000000000000000000000000000000000000000..1f59498d421b7e1d3e76a1a38f604181d11c4649
|
||
|
--- /dev/null
|
||
|
+++ b/package/network/config/netifd/patches/0001-ubus-add-interface-method-to-trigger-renew-event.patch
|
||
|
@@ -0,0 +1,73 @@
|
||
|
+From 8b39c2fce4c1da3f3dcd4c6fd305c124714839e8 Mon Sep 17 00:00:00 2001
|
||
|
+Message-Id: <8b39c2fce4c1da3f3dcd4c6fd305c124714839e8.1491956920.git.mschiffer@universe-factory.net>
|
||
|
+From: Matthias Schiffer <mschiffer@universe-factory.net>
|
||
|
+Date: Wed, 12 Apr 2017 02:25:33 +0200
|
||
|
+Subject: [PATCH] ubus: add interface method to trigger renew event
|
||
|
+
|
||
|
+proto-shell handlers may implement all kinds of renew handlers, there
|
||
|
+should be a way to explicitly trigger such a renew.
|
||
|
+
|
||
|
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
|
||
|
+---
|
||
|
+ interface.c | 8 ++++++++
|
||
|
+ interface.h | 1 +
|
||
|
+ ubus.c | 14 ++++++++++++++
|
||
|
+ 3 files changed, 23 insertions(+)
|
||
|
+
|
||
|
+--- a/interface.c
|
||
|
++++ b/interface.c
|
||
|
+@@ -1076,6 +1076,14 @@ interface_set_down(struct interface *ifa
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+
|
||
|
++int interface_renew(struct interface *iface)
|
||
|
++{
|
||
|
++ if (iface->state == IFS_TEARDOWN || iface->state == IFS_DOWN)
|
||
|
++ return -1;
|
||
|
++
|
||
|
++ return interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
|
||
|
++}
|
||
|
++
|
||
|
+ void
|
||
|
+ interface_start_pending(void)
|
||
|
+ {
|
||
|
+--- a/interface.h
|
||
|
++++ b/interface.h
|
||
|
+@@ -184,6 +184,7 @@ void interface_set_available(struct inte
|
||
|
+ int interface_set_up(struct interface *iface);
|
||
|
+ int interface_set_down(struct interface *iface);
|
||
|
+ void __interface_set_down(struct interface *iface, bool force);
|
||
|
++int interface_renew(struct interface *iface);
|
||
|
+
|
||
|
+ void interface_set_main_dev(struct interface *iface, struct device *dev);
|
||
|
+ void interface_set_l3_dev(struct interface *iface, struct device *dev);
|
||
|
+--- a/ubus.c
|
||
|
++++ b/ubus.c
|
||
|
+@@ -376,6 +376,19 @@ netifd_handle_down(struct ubus_context *
|
||
|
+ 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)
|
||
|
+ {
|
||
|
+@@ -912,6 +925,7 @@ netifd_handle_set_data(struct ubus_conte
|
||
|
+ 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 },
|