[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9fec5ff1d75fa72511606b8a6b810ccdccbcb074.camel@bisdn.de>
Date: Fri, 07 Sep 2018 15:42:57 +0200
From: Tobias Jungel <tobias.jungel@...dn.de>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: [iproute2 PATCH] bridge: Correct json output
The current implementation adds configured vlans as "vlan": [ ... ] into
an array. This is malformed json and fails to be parsed. This patch
creates an object to include this key value pair.
Test with:
ip l a type bridge
./bridge/bridge -j vlan | jq
fixes c7c1a1ef5
Signed-off-by: Tobias Jungel <tobias.jungel@...dn.de>
---
bridge/vlan.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 19a36b80..9376b985 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -632,6 +632,7 @@ void print_vlan_info(FILE *fp, struct rtattr *tb)
if (!is_json_context())
fprintf(fp, "%s", _SL_);
+ open_json_object(NULL);
open_json_array(PRINT_JSON, "vlan");
for (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
@@ -659,6 +660,7 @@ void print_vlan_info(FILE *fp, struct rtattr *tb)
}
close_json_array(PRINT_ANY, "\n");
+ close_json_object();
}
int do_vlan(int argc, char **argv)
Powered by blists - more mailing lists