From: Victor Nogueira Date: Tue, 3 Mar 2026 13:07:33 +0000 (-0300) Subject: tc: Add JSON output support to multiq X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ac8d234f7361fcba57d2f6b4ff5a27cd1deba2a;p=thirdparty%2Fiproute2.git tc: Add JSON output support to multiq 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 Signed-off-by: David Ahern --- diff --git a/tc/q_multiq.c b/tc/q_multiq.c index 63fffed4..0e8e2f9e 100644 --- a/tc/q_multiq.c +++ b/tc/q_multiq.c @@ -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; }