summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-03-29 01:16:59 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-03-29 01:16:59 +0200
commitd5202486636818e3ff48ede9d3e06c886c659c0a (patch)
tree9cefcabc1a153efd38dcb295bf386e4cd5dfc37c /ubus.c
parentf62eea9492a669bcf96464e85f04ae5e80190a76 (diff)
add rudimentary protocol handling
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ubus.c b/ubus.c
index 159d5f5..e5df1fb 100644
--- a/ubus.c
+++ b/ubus.c
@@ -138,12 +138,18 @@ static int netifd_handle_status(struct ubus_context *ctx, struct ubus_object *ob
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
+ static const char *iface_state[] = {
+ [IFS_SETUP] = "setup",
+ [IFS_UP] = "up",
+ [IFS_TEARDOWN] = "teardown",
+ [IFS_DOWN] = "down",
+ };
struct interface *iface;
iface = container_of(obj, struct interface, ubus);
blob_buf_init(&b, 0);
- blobmsg_add_u8(&b, "up", iface->up);
+ blobmsg_add_string(&b, "state", iface_state[iface->state]);
blobmsg_add_u8(&b, "active", iface->active);
blobmsg_add_u8(&b, "autostart", iface->autostart);
if (iface->main_dev.dev) {