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: <20190506161840.30919-3-nir.weiner@oracle.com>
Date:   Mon,  6 May 2019 19:18:39 +0300
From:   Nir Weiner <nir.weiner@...cle.com>
To:     netdev@...r.kernel.org
Cc:     liran.alon@...cle.com, nir.weiner@...cle.com
Subject: [iproute2 2/3] tc: jsonify tbf qdisc parameters

Add json output to tbf qdisc parameters.

Acked-by: John Haxby <john.haxby@...cle.com>
Signed-off-by: Nir Weiner <nir.weiner@...cle.com>
Suggested-by: Liran Alon <liran.alon@...cle.com>
---
 tc/q_tbf.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index b9465b20d2be..fd824e67e4f2 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -285,32 +285,32 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	if (tb[TCA_TBF_RATE64] &&
 	    RTA_PAYLOAD(tb[TCA_TBF_RATE64]) >= sizeof(rate64))
 		rate64 = rta_getattr_u64(tb[TCA_TBF_RATE64]);
-	fprintf(f, "rate %s ", sprint_rate(rate64, b1));
+	print_string(PRINT_ANY, "rate", "rate %s ", sprint_rate(rate64, b1));
 	buffer = tc_calc_xmitsize(rate64, qopt->buffer);
 	if (show_details) {
 		fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
 			1<<qopt->rate.cell_log, sprint_size(qopt->rate.mpu, b2));
 	} else {
-		fprintf(f, "burst %s ", sprint_size(buffer, b1));
+		print_string(PRINT_ANY, "burst", "burst %s ", sprint_size(buffer, b1));
 	}
 	if (show_raw)
-		fprintf(f, "[%08x] ", qopt->buffer);
+		print_0xhex(PRINT_ANY, "buffer", "[%08x] ", qopt->buffer);
 	prate64 = qopt->peakrate.rate;
 	if (tb[TCA_TBF_PRATE64] &&
 	    RTA_PAYLOAD(tb[TCA_TBF_PRATE64]) >= sizeof(prate64))
 		prate64 = rta_getattr_u64(tb[TCA_TBF_PRATE64]);
 	if (prate64) {
-		fprintf(f, "peakrate %s ", sprint_rate(prate64, b1));
+		print_string(PRINT_ANY, "peakrate", "peakrate %s ", sprint_rate(prate64, b1));
 		if (qopt->mtu || qopt->peakrate.mpu) {
 			mtu = tc_calc_xmitsize(prate64, qopt->mtu);
 			if (show_details) {
 				fprintf(f, "mtu %s/%u mpu %s ", sprint_size(mtu, b1),
 					1<<qopt->peakrate.cell_log, sprint_size(qopt->peakrate.mpu, b2));
 			} else {
-				fprintf(f, "minburst %s ", sprint_size(mtu, b1));
+				print_string(PRINT_ANY, "minburst", "minburst %s ", sprint_size(mtu, b1));
 			}
 			if (show_raw)
-				fprintf(f, "[%08x] ", qopt->mtu);
+				print_0xhex(PRINT_ANY, "mtu", "[%08x] ", qopt->mtu);
 		}
 	}
 
@@ -322,16 +322,16 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 			latency = lat2;
 	}
 	if (latency >= 0.0)
-		fprintf(f, "lat %s ", sprint_time(latency, b1));
+		print_string(PRINT_ANY, "lat", "lat %s ", sprint_time(latency, b1));
 	if (show_raw || latency < 0.0)
-		fprintf(f, "limit %s ", sprint_size(qopt->limit, b1));
+		print_string(PRINT_ANY, "limit", "limit %s ", sprint_size(qopt->limit, b1));
 
 	if (qopt->rate.overhead) {
-		fprintf(f, "overhead %d", qopt->rate.overhead);
+		print_int(PRINT_ANY, "overhead", "overhead %d", qopt->rate.overhead);
 	}
 	linklayer = (qopt->rate.linklayer & TC_LINKLAYER_MASK);
 	if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
-		fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b3));
+		print_string(PRINT_ANY, "linklayer", "linklayer %s ", sprint_linklayer(linklayer, b3));
 
 	return 0;
 }
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ