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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171125144835.5045-5-jiri@resnulli.us>
Date:   Sat, 25 Nov 2017 15:48:28 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, jhs@...atatu.com, mlxsw@...lanox.com
Subject: [patch iproute2 04/11] tc: jsonify htb qdisc

From: Jiri Pirko <jiri@...lanox.com>

Add json output to htb qdisc.

Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
 tc/q_htb.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tc/q_htb.c b/tc/q_htb.c
index ffb43aa..3fc2acb 100644
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -293,9 +293,10 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 		if (RTA_PAYLOAD(tb[TCA_HTB_PARMS])  < sizeof(*hopt)) return -1;
 
 		if (!hopt->level) {
-			fprintf(f, "prio %d ", (int)hopt->prio);
+			print_int(PRINT_ANY, "prio", "prio ", (int)hopt->prio);
 			if (show_details)
-				fprintf(f, "quantum %d ", (int)hopt->quantum);
+				print_int(PRINT_ANY, "quantum", "quantum ",
+					  (int)hopt->quantum);
 		}
 
 		rate64 = hopt->rate.rate;
@@ -341,16 +342,21 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 		gopt = RTA_DATA(tb[TCA_HTB_INIT]);
 		if (RTA_PAYLOAD(tb[TCA_HTB_INIT])  < sizeof(*gopt)) return -1;
 
-		fprintf(f, "r2q %d default %x direct_packets_stat %u",
-			gopt->rate2quantum, gopt->defcls, gopt->direct_pkts);
-		if (show_details)
-			fprintf(f, " ver %d.%d", gopt->version >> 16, gopt->version & 0xffff);
+		print_int(PRINT_ANY, "r2q", "r2q %d", gopt->rate2quantum);
+		print_uint(PRINT_ANY, "default", " default %u", gopt->defcls);
+		print_uint(PRINT_ANY, "direct_packets_stat",
+			   " direct_packets_stat %u", gopt->direct_pkts);
+		if (show_details) {
+			sprintf(b1, "%d.%d", gopt->version >> 16, gopt->version & 0xffff);
+			print_string(PRINT_ANY, "ver", " ver %s", b1);
+		}
 	}
 	if (tb[TCA_HTB_DIRECT_QLEN] &&
 	    RTA_PAYLOAD(tb[TCA_HTB_DIRECT_QLEN]) >= sizeof(__u32)) {
 		__u32 direct_qlen = rta_getattr_u32(tb[TCA_HTB_DIRECT_QLEN]);
 
-		fprintf(f, " direct_qlen %u", direct_qlen);
+		print_uint(PRINT_ANY, "direct_qlen", " direct_qlen %u",
+			   direct_qlen);
 	}
 	return 0;
 }
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ