summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-03-27 19:15:32 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-03-27 19:15:32 +0200
commit2cfb961768f9f896a75b6981d63a957d121f1cdc (patch)
tree38b4e4ff86af9a6661fa9b885111007513c88192 /ubus.c
parent93e1972d5264f5cea97b4d989084cfbc6b323248 (diff)
move all device data to its own table to prevent namespace collisions
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ubus.c b/ubus.c
index 2bb42f1..601a116 100644
--- 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);