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:52 -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 25/31] tc/dsmark: implement JSON output

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

Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 tc/q_dsmark.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tc/q_dsmark.c b/tc/q_dsmark.c
index d3e8292d777c..d2b9e3885377 100644
--- a/tc/q_dsmark.c
+++ b/tc/q_dsmark.c
@@ -131,28 +131,37 @@ static int dsmark_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	if (tb[TCA_DSMARK_MASK]) {
 		if (!RTA_PAYLOAD(tb[TCA_DSMARK_MASK]))
 			fprintf(stderr, "dsmark: empty mask\n");
-		else fprintf(f, "mask 0x%02x ",
-			    rta_getattr_u8(tb[TCA_DSMARK_MASK]));
+		else
+			print_0xhex(PRINT_ANY, "mask",
+				    "mask 0x%02x ",
+				    rta_getattr_u8(tb[TCA_DSMARK_MASK]));
 	}
 	if (tb[TCA_DSMARK_VALUE]) {
 		if (!RTA_PAYLOAD(tb[TCA_DSMARK_VALUE]))
 			fprintf(stderr, "dsmark: empty value\n");
-		else fprintf(f, "value 0x%02x ",
-			    rta_getattr_u8(tb[TCA_DSMARK_VALUE]));
+		else
+			print_0xhex(PRINT_ANY, "value",
+				    "value 0x%02x ",
+				    rta_getattr_u8(tb[TCA_DSMARK_VALUE]));
 	}
 	if (tb[TCA_DSMARK_INDICES]) {
 		if (RTA_PAYLOAD(tb[TCA_DSMARK_INDICES]) < sizeof(__u16))
 			fprintf(stderr, "dsmark: indices too short\n");
-		else fprintf(f, "indices 0x%04x ",
-			    rta_getattr_u16(tb[TCA_DSMARK_INDICES]));
+		else
+			print_0xhex(PRINT_ANY, "indcies",
+				    "indices 0x%04x ",
+				    rta_getattr_u16(tb[TCA_DSMARK_INDICES]));
 	}
 	if (tb[TCA_DSMARK_DEFAULT_INDEX]) {
 		if (RTA_PAYLOAD(tb[TCA_DSMARK_DEFAULT_INDEX]) < sizeof(__u16))
 			fprintf(stderr, "dsmark: default_index too short\n");
-		else fprintf(f, "default_index 0x%04x ",
-			    rta_getattr_u16(tb[TCA_DSMARK_DEFAULT_INDEX]));
+		else
+			print_0xhex(PRINT_ANY, "default_index",
+				    "default_index 0x%04x ",
+				    rta_getattr_u16(tb[TCA_DSMARK_DEFAULT_INDEX]));
 	}
-	if (tb[TCA_DSMARK_SET_TC_INDEX]) fprintf(f, "set_tc_index ");
+	if (tb[TCA_DSMARK_SET_TC_INDEX])
+		print_null(PRINT_ANY, "set_tc_index", "set_tc_index ", NULL);
 	return 0;
 }
 
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ