move all device data to its own table to prevent namespace collisions
authorFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 17:15:32 +0000 (19:15 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 17:15:32 +0000 (19:15 +0200)
ubus.c

diff --git a/ubus.c b/ubus.c
index 2bb42f1ff52a9dcfe20f18505efce24d470eea67..601a1165c34b31a99fb1f9d883eb8664bc687d15 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -145,15 +145,22 @@ static int netifd_handle_status(struct ubus_context *ctx, struct ubus_object *ob
        blobmsg_add_u8(&b, "autostart", iface->autostart);
        if (iface->main_dev.dev) {
                struct device *dev = iface->main_dev.dev;
+               const char *field;
+               void *devinfo;
 
+               /* use a different field for virtual devices */
                if (dev->avl.key)
-                       blobmsg_add_string(&b, "device", dev->ifname);
+                       field = "device";
                else
-                       /* use a different field for virtual devices */
-                       blobmsg_add_string(&b, "link", dev->ifname);
+                       field = "link";
+
+               devinfo = blobmsg_open_table(&b, field);
+               blobmsg_add_string(&b, "name", dev->ifname);
 
                if (dev->type->dump_status)
                        dev->type->dump_status(dev, &b);
+
+               blobmsg_close_table(&b, devinfo);
        }
 
        ubus_send_reply(ctx, req, b.head);