diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-03-29 01:16:59 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-03-29 01:16:59 +0200 |
commit | d5202486636818e3ff48ede9d3e06c886c659c0a (patch) | |
tree | 9cefcabc1a153efd38dcb295bf386e4cd5dfc37c /ubus.c | |
parent | f62eea9492a669bcf96464e85f04ae5e80190a76 (diff) |
add rudimentary protocol handling
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) { |