summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-10 19:12:43 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-10 19:12:43 +0200
commit34a1a4bad31ba6f138cd6a98249c774ff66285d1 (patch)
tree0e6f0b0af6edbb66490145b47fc5b60c9d58608c /ubus.c
parent3085170188cc5bf04f4cfb6f07c292e06d2b40a8 (diff)
add interface uptime to the status info
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ubus.c b/ubus.c
index ca5d110..da00b80 100644
--- a/ubus.c
+++ b/ubus.c
@@ -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;