ucode: fix passing network vlan on handle_link
authorFelix Fietkau <[email protected]>
Wed, 6 Aug 2025 10:03:57 +0000 (12:03 +0200)
committerFelix Fietkau <[email protected]>
Wed, 6 Aug 2025 10:03:59 +0000 (12:03 +0200)
Use an extra container element to ensure that the type matches

Signed-off-by: Felix Fietkau <[email protected]>
ucode.c

diff --git a/ucode.c b/ucode.c
index fdddab7ed8123f27b0643ba47458d653beab1774..291bb3e3bdf06e81f3b7051fc39e78c31568a611 100644 (file)
--- a/ucode.c
+++ b/ucode.c
@@ -177,14 +177,18 @@ uc_netifd_interface_handle_link(uc_vm_t *vm, size_t nargs)
 
        if (vlan) {
                size_t len = ucv_array_length(vlan);
+               void *c;
 
                blob_buf_init(&b, 0);
+               c = blobmsg_open_array(&b, "vlan");
                for (size_t i = 0; i < len; i++) {
                        uc_value_t *val = ucv_array_get(vlan, i);
                        if (ucv_type(val) == UC_STRING)
                                blobmsg_add_string(&b, NULL, ucv_string_get(val));
                }
-               vlan_attr = b.head;
+               blobmsg_close_array(&b, c);
+
+               vlan_attr = blobmsg_data(b.head);
        }
 
        ret = interface_handle_link(iface, ucv_string_get(ifname), vlan_attr, up, link_ext);