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]
Message-ID: <0106018d95d12587-2a5518e8-5e89-4d5c-b7d5-93455429cb1d-000000@ap-northeast-1.amazonses.com>
Date: Sun, 11 Feb 2024 01:38:48 +0000
From: Takanori Hirano <me@...tknr.net>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, Takanori Hirano <me@...tknr.net>
Subject: [PATCH v2] tc: Change of json format in tc-fw

In the case of a process such as mapping a json to a structure,
it can be difficult if the keys have the same name but different types.
Since handle is used in hex string, change it to fw.

Signed-off-by: Takanori Hirano <me@...tknr.net>
---
Changes in v2:
 - Modified to use print_nl.
 - Modified to use print_0xhex from print_hex.
---
 tc/f_fw.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tc/f_fw.c b/tc/f_fw.c
index fe99cd42..5e72e526 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -124,16 +124,16 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
 	if (handle || tb[TCA_FW_MASK]) {
 		__u32 mark = 0, mask = 0;
 
-		open_json_object("handle");
+		open_json_object("fw");
 		if (handle)
 			mark = handle;
 		if (tb[TCA_FW_MASK] &&
 		    (mask = rta_getattr_u32(tb[TCA_FW_MASK])) != 0xFFFFFFFF) {
-			print_hex(PRINT_ANY, "mark", "handle 0x%x", mark);
-			print_hex(PRINT_ANY, "mask", "/0x%x ", mask);
+			print_0xhex(PRINT_ANY, "mark", "handle 0x%x", mark);
+			print_0xhex(PRINT_ANY, "mask", "/0x%x ", mask);
 		} else {
-			print_hex(PRINT_ANY, "mark", "handle 0x%x ", mark);
-			print_hex(PRINT_JSON, "mask", NULL, 0xFFFFFFFF);
+			print_0xhex(PRINT_ANY, "mark", "handle 0x%x ", mark);
+			print_0xhex(PRINT_JSON, "mask", NULL, 0xFFFFFFFF);
 		}
 		close_json_object();
 	}
@@ -155,7 +155,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
 	}
 
 	if (tb[TCA_FW_ACT]) {
-		print_string(PRINT_FP, NULL, "\n", "");
+		print_nl();
 		tc_print_action(f, tb[TCA_FW_ACT], 0);
 	}
 	return 0;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ