Files
wlan-ap/patches-20.x/0014-netifd-add-interface-to-status-messages.patch
John Crispin a6a28f5aab openwrt-20.x: add support for latest 20.x
This is opt-in and we continue to use the 19.07 tree as the default.

Signed-off-by: John Crispin <john@phrozen.org>
2020-12-02 12:14:16 +01:00

56 lines
2.0 KiB
Diff

From 326717d5219cc6e6d7b98298380b70a7b19b73e5 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 29 Jul 2020 12:30:42 +0200
Subject: [PATCH 14/25] netifd: add interface to status messages
Add the interface name to the status messages. Otherwise we cannot identify the content.
Signed-off-by: John Crispin <john@phrozen.org>
---
.../netifd/patches/0103-ubus-iface.patch | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 package/network/config/netifd/patches/0103-ubus-iface.patch
diff --git a/package/network/config/netifd/patches/0103-ubus-iface.patch b/package/network/config/netifd/patches/0103-ubus-iface.patch
new file mode 100644
index 0000000000..2c489fe96a
--- /dev/null
+++ b/package/network/config/netifd/patches/0103-ubus-iface.patch
@@ -0,0 +1,33 @@
+Index: netifd-2019-08-05-5e02f944/ubus.c
+===================================================================
+--- netifd-2019-08-05-5e02f944.orig/ubus.c
++++ netifd-2019-08-05-5e02f944/ubus.c
+@@ -1276,6 +1276,20 @@ netifd_ubus_interface_notify(struct inte
+ ubus_notify(ubus_ctx, &iface->ubus, event, b.head, -1);
+ }
+
++static void
++iface_subscribe_handler(struct ubus_context *ctx, struct ubus_object *obj)
++{
++ struct interface *iface;
++
++ iface = container_of(obj, struct interface, ubus);
++ if (!iface->ubus.has_subscribers)
++ return;
++ blob_buf_init(&b, 0);
++ blobmsg_add_string(&b, "interface", iface->name);
++ netifd_dump_status(iface);
++ ubus_notify(ubus_ctx, &iface->ubus, "interface.update", b.head, -1);
++}
++
+ void
+ netifd_ubus_add_interface(struct interface *iface)
+ {
+@@ -1289,6 +1303,7 @@ netifd_ubus_add_interface(struct interfa
+ obj->type = &iface_object_type;
+ obj->methods = iface_object_methods;
+ obj->n_methods = ARRAY_SIZE(iface_object_methods);
++ obj->subscribe_cb = iface_subscribe_handler;
+ if (ubus_add_object(ubus_ctx, &iface->ubus)) {
+ DPRINTF("failed to publish ubus object for interface '%s'\n", iface->name);
+ free(name);
--
2.25.1