diff mbox series

[iproute2,4/5] simple: support json output

Message ID 20240312225456.87937-5-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit 69d55c213da8650b6ac8b54777475874673b0cdd
Delegated to: Stephen Hemminger
Headers show
Series tc: more JSON fixes | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger March 12, 2024, 10:53 p.m. UTC
Last action that never got JSON support.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 tc/m_simple.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tc/m_simple.c b/tc/m_simple.c
index fe2bca21ae46..6eb60bd8a924 100644
--- a/tc/m_simple.c
+++ b/tc/m_simple.c
@@ -179,9 +179,11 @@  static int print_simple(struct action_util *au, FILE *f, struct rtattr *arg)
 
 	simpdata = RTA_DATA(tb[TCA_DEF_DATA]);
 
-	fprintf(f, "Simple <%s>\n", simpdata);
-	fprintf(f, "\t index %u ref %d bind %d", sel->index,
-		sel->refcnt, sel->bindcnt);
+	print_string(PRINT_ANY, "simple", "Simple <%s>", simpdata);
+	print_nl();
+	print_uint(PRINT_ANY, "index", "\t index %u ", sel->index);
+	print_int(PRINT_ANY, "ref", "ref %d ", sel->refcnt);
+	print_int(PRINT_ANY, "bind","bind %d", sel->bindcnt);
 
 	if (show_stats) {
 		if (tb[TCA_DEF_TM]) {