lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Jul 2018 14:05:39 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     netdev@...r.kernel.org
Cc:     Stephen Hemminger <sthemmin@...rosoft.com>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH v2 iproute2-next 12/31] tc/rr: implement JSON output

From: Stephen Hemminger <sthemmin@...rosoft.com>

Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 tc/q_rr.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tc/q_rr.c b/tc/q_rr.c
index 843a4faeef41..dcc58ac98ba2 100644
--- a/tc/q_rr.c
+++ b/tc/q_rr.c
@@ -101,13 +101,19 @@ static int rr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 						sizeof(*qopt)))
 		return -1;
 
-	fprintf(f, "bands %u priomap ", qopt->bands);
+	print_uint(PRINT_ANY, "bands", "bands %u priomap ", qopt->bands);
+	open_json_array(PRINT_JSON, "priomap");
 	for (i = 0; i <= TC_PRIO_MAX; i++)
-		fprintf(f, " %d", qopt->priomap[i]);
+		print_uint(PRINT_ANY, NULL, " %u", qopt->priomap[i]);
+	close_json_array(PRINT_JSON, NULL);
 
-	if (tb[TCA_PRIO_MQ])
-		fprintf(f, " multiqueue: %s ",
-			rta_getattr_u8(tb[TCA_PRIO_MQ]) ? "on" : "off");
+	if (tb[TCA_PRIO_MQ]) {
+		bool mq = rta_getattr_u8(tb[TCA_PRIO_MQ]);
+
+		print_string(PRINT_FP, NULL, " multiqueue: %s ",
+			     mq ? "on" : "off");
+		print_bool(PRINT_JSON, "multiqueue", NULL, mq);
+	}
 
 	return 0;
 }
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ