jsoninfo: in /interfaces show 'state' text as 'up' boolean
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 18 Mar 2016 12:57:18 +0000 (13:57 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 18 Mar 2016 12:57:51 +0000 (13:57 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/jsoninfo/src/olsrd_jsoninfo.c

index d8b59d9..4a30797 100644 (file)
@@ -289,14 +289,12 @@ static void print_interface_olsr(struct autobuf *abuf, const char * name, struct
   assert(name);
 
   abuf_json_mark_object(true, false, abuf, name);
+  abuf_json_boolean(abuf, "up", rifs != NULL);
   if (!rifs) {
-    abuf_json_string(abuf, "state", "down");
     abuf_json_mark_object(false, false, abuf, NULL);
     return;
   }
 
-  abuf_json_string(abuf, "state", "up");
-
   abuf_json_string(abuf, "ipv4Address", ip4_to_string(&addrbuf, rifs->int_addr.sin_addr));
   abuf_json_string(abuf, "ipv4Netmask", ip4_to_string(&addrbuf, rifs->int_netmask.sin_addr));
   abuf_json_string(abuf, "ipv4Broadcast", ip4_to_string(&addrbuf, rifs->int_broadaddr.sin_addr));