]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: Add JSON output support to multiq
authorVictor Nogueira <victor@mojatatu.com>
Tue, 3 Mar 2026 13:07:33 +0000 (10:07 -0300)
committerDavid Ahern <dsahern@kernel.org>
Sat, 7 Mar 2026 01:13:49 +0000 (18:13 -0700)
Since qdisc core already assumes all qdiscs are able to output JSON,
add JSON output support to multiq.

Fixes: c91d262f414d ("tc: jsonify qdisc core")
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/q_multiq.c

index 63fffed42cf27f553a4ecaa1ed786129bad5e2c6..0e8e2f9e093bbce78f819b6133cbbda82c3a3e41 100644 (file)
@@ -51,6 +51,7 @@ static int multiq_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
 static int multiq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
        struct tc_multiq_qopt *qopt;
+       SPRINT_BUF(b1);
 
        if (opt == NULL)
                return 0;
@@ -59,7 +60,10 @@ static int multiq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr
 
        qopt = RTA_DATA(opt);
 
-       fprintf(f, "bands %u/%u ", qopt->bands, qopt->max_bands);
+       snprintf(b1, SPRINT_BSIZE, "%u/%u", qopt->bands, qopt->max_bands);
+       print_string(PRINT_FP, NULL, "bands %s ", b1);
+       print_uint(PRINT_JSON, "bands", NULL, qopt->bands);
+       print_uint(PRINT_JSON, "max_bands", NULL, qopt->max_bands);
 
        return 0;
 }