diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-10 19:12:43 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-10 19:12:43 +0200 |
commit | 34a1a4bad31ba6f138cd6a98249c774ff66285d1 (patch) | |
tree | 0e6f0b0af6edbb66490145b47fc5b60c9d58608c /ubus.c | |
parent | 3085170188cc5bf04f4cfb6f07c292e06d2b40a8 (diff) |
add interface uptime to the status info
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include "interface.h" #include "proto.h" #include "ubus.h" +#include "system.h" static struct ubus_context *ctx = NULL; static struct blob_buf b; @@ -177,6 +178,12 @@ netifd_handle_status(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u8(&b, "pending", iface->state == IFS_SETUP); blobmsg_add_u8(&b, "available", iface->available); blobmsg_add_u8(&b, "autostart", iface->autostart); + + if (iface->state == IFS_UP) { + time_t cur = system_get_rtime(); + blobmsg_add_u32(&b, "uptime", cur - iface->start_time); + } + if (iface->main_dev.dev) { struct device *dev = iface->main_dev.dev; const char *field; |