]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: jsonify output of q_fifo
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 5 Oct 2018 00:08:34 +0000 (17:08 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 8 Oct 2018 16:22:22 +0000 (09:22 -0700)
Print limits correctly in JSON context.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/q_fifo.c

index cb86a404d4de4764ba3d305bfe8c6a35e29800ea..61493fbbc5bcc4d3b6cf434deb3c9881c18f61fe 100644 (file)
@@ -69,9 +69,12 @@ static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
        qopt = RTA_DATA(opt);
        if (strcmp(qu->id, "bfifo") == 0) {
                SPRINT_BUF(b1);
-               fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
-       } else
-               fprintf(f, "limit %up", qopt->limit);
+               print_uint(PRINT_JSON, "limit", NULL, qopt->limit);
+               print_string(PRINT_FP, NULL, "limit %s",
+                            sprint_size(qopt->limit, b1));
+       } else {
+               print_uint(PRINT_ANY, "limit", "limit %up", qopt->limit);
+       }
        return 0;
 }