Thread (5 messages) 5 messages, 2 authors, 2026-03-07
STALE85d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH iproute2 v2 3/3] tc: Add JSON output support to multiq

From: Victor Nogueira <hidden>
Date: 2026-03-03 13:07:54
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 tc/q_multiq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
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;
 }
-- 
2.53.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help