summaryrefslogtreecommitdiff
path: root/ubus.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-08-22 08:00:18 +0200
committerFelix Fietkau <nbd@nbd.name>2021-08-24 12:58:57 +0200
commit6519cf31e4b033fd4a03c031ad882166be84fa6d (patch)
tree78f2fa0ef9bb0f59994b5c404edf76026fbbdba2 /ubus.c
parented84473b7af96f4fc4d161bf60eeaa51bed7077b (diff)
downloadnetifd-6519cf31e4b033fd4a03c031ad882166be84fa6d.tar.gz
bridge: add support for an external STP daemon
netifd notifies the stp daemon through the network.device object and sends STP related configuration parameters. The daemon can also trigger a STP restart in order to close the race on init Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ubus.c b/ubus.c
index 8a0c53a..56cce81 100644
--- a/ubus.c
+++ b/ubus.c
@@ -371,6 +371,16 @@ netifd_handle_dev_hotplug(struct ubus_context *ctx, struct ubus_object *obj,
}
#endif
+static int
+netifd_handle_stp_init(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ device_stp_init();
+
+ return 0;
+}
+
static struct ubus_method dev_object_methods[] = {
UBUS_METHOD("status", netifd_dev_status, dev_policy),
UBUS_METHOD("set_alias", netifd_handle_alias, alias_attrs),
@@ -378,6 +388,7 @@ static struct ubus_method dev_object_methods[] = {
#ifdef DUMMY_MODE
UBUS_METHOD("hotplug_event", netifd_handle_dev_hotplug, dev_hotplug_policy),
#endif
+ UBUS_METHOD_NOARG("stp_init", netifd_handle_stp_init)
};
static struct ubus_object_type dev_object_type =
@@ -397,6 +408,11 @@ netifd_ubus_add_fd(void)
system_fd_set_cloexec(ubus_ctx->sock.fd);
}
+void netifd_ubus_device_notify(const char *event, struct blob_attr *data, int timeout)
+{
+ ubus_notify(ubus_ctx, &dev_object, event, data, timeout);
+}
+
static void
netifd_ubus_reconnect_timer(struct uloop_timeout *timeout)
{