From 549e84e5fea7230c5471d6a3dbddcc7d3152f665 Mon Sep 17 00:00:00 2001 From: Marek Kwaczynski Date: Fri, 8 Aug 2025 12:49:11 +0200 Subject: [PATCH] ucentral-client: Add discovery metadata to connect payload Includes contents of /etc/ucentral/discovery.state.json (if present) in the "discovery" field of the connect message. This allows the controller to identify how the device discovered its cloud endpoint. Fixes: WIFI-14966 Signed-off-by: Marek Kwaczynski --- proto.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proto.c b/proto.c index c9966d6..3b04737 100644 --- a/proto.c +++ b/proto.c @@ -217,6 +217,14 @@ connect_send(void) } blobmsg_close_table(&proto, c); } + if (!stat("/etc/ucentral/discovery.state.json", &statbuf)) { + c = blobmsg_open_table(&proto, "discovery"); + if (!blobmsg_add_json_from_file(&proto, "/etc/ucentral/discovery.state.json")) { + log_send("failed to load discovery state", LOG_ERR); + return; + } + blobmsg_close_table(&proto, c); + } if (!stat("/tmp/udhcpc-vsi.json", &statbuf)) { c = blobmsg_open_table(&proto, "udhcpc-vsi"); if (!blobmsg_add_json_from_file(&proto, "/tmp/udhcpc-vsi.json")) {