[openwrt/openwrt] unetd: cli: add hook calls for invite/join status changes

LEDE Commits lede-commits at lists.infradead.org
Wed May 14 02:23:27 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7f1b9a42093ff0103b622d1a9e5c1d2ce208ce92

commit 7f1b9a42093ff0103b622d1a9e5c1d2ce208ce92
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed May 14 11:21:56 2025 +0200

    unetd: cli: add hook calls for invite/join status changes
    
    Allows different frontends to interact without parsing human readable
    messages
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/unetd/files/unet.uc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/network/services/unetd/files/unet.uc b/package/network/services/unetd/files/unet.uc
index 01ff05c3b1..f58b502f02 100644
--- a/package/network/services/unetd/files/unet.uc
+++ b/package/network/services/unetd/files/unet.uc
@@ -549,6 +549,7 @@ function network_invite_peer_update(model, ctx, msg)
 		model.status_msg("Updated configuration");
 	}
 
+	model.run_hook("unet_enroll", "invite_done");
 	__network_enroll_cancel(model, ctx);
 }
 
@@ -576,8 +577,10 @@ function network_invite(ctx, argv, named)
 	invite.sub = model.ubus.subscriber((msg) => {
 		if (msg.type == "enroll_peer_update")
 			network_invite_peer_update(ctx.model, ctx, msg);
-		else if (msg.type == "enroll_timeout")
+		else if (msg.type == "enroll_timeout") {
+			ctx.model.run_hook("unet_enroll", "invite_timeout");
 			__network_enroll_cancel(ctx.model, ctx);
+		}
 	});
 
 	let req = {
@@ -627,6 +630,7 @@ function network_join_peer_update(model, ctx, msg)
 
 	model.status_msg("Configuration added for interface " + name);
 
+	model.run_hook("unet_enroll", "join_done");
 	__network_enroll_cancel(model, ctx);
 }
 
@@ -681,8 +685,10 @@ function network_join(ctx, argv, named)
 	data.sub = model.ubus.subscriber((msg) => {
 		if (msg.type == "enroll_peer_update")
 			network_join_peer_update(ctx.model, ctx, msg);
-		else if (msg.type == "enroll_timeout")
+		else if (msg.type == "enroll_timeout") {
+			ctx.model.run_hook("unet_enroll", "join_timeout");
 			__network_enroll_cancel(ctx.model, ctx);
+		}
 	});
 	data.sub.subscribe("unetd");
 	model.ubus.call("unetd", "enroll_start", req);




More information about the lede-commits mailing list