Files
wlan-ap/patches/0004-netifd-add-interface-to-status-messages.patch
John Crispin 7ae17f821b ipq807x: update kernel patches and add new boards
Signed-off-by: John Crispin <john@phrozen.org>
2021-01-18 08:03:29 +01:00

56 lines
2.0 KiB
Diff

From 2e2b1971f17138b3b7611fd6c223206be6f5a28a Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 29 Jul 2020 12:30:42 +0200
Subject: [PATCH 04/40] 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