service: fix object nesting in the ubus get_data call main master
authorFelix Fietkau <nbd@nbd.name>
Tue, 12 Aug 2025 15:31:25 +0000 (17:31 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 12 Aug 2025 15:31:26 +0000 (17:31 +0200)
Depending on the contents, instance sub-objects can be confused with
per-service data items. Fix the nesting by making an instance object
for service items.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
service/service.c

index 515c9922843cfdcd25e4dd37b520ec9cd3d94b81..4070e74ec865105e2a953390bb10de3c3641072f 100644 (file)
@@ -838,10 +838,15 @@ service_get_data(struct ubus_context *ctx, struct ubus_object *obj,
 
                        if (!cs)
                                cs = blobmsg_open_table(&b, s->name);
+                       if (!ci)
+                               ci = blobmsg_open_table(&b, "*");
 
                        blobmsg_add_blob(&b, var->data);
                }
 
+               if (ci)
+                       blobmsg_close_table(&b, ci);
+
                vlist_for_each_element(&s->instances, in, node) {
                        ci = NULL;