aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakanori Hirano <me@hrntknr.net>2024-02-11 01:38:48 +0000
committerStephen Hemminger <stephen@networkplumber.org>2024-02-19 10:08:49 -0800
commitbc5468c5ebc5085b931b2d0e73702b977d25c5f4 (patch)
tree10cf4448a5a5e830bf2f971d99705e0ee38ad01c
parentd9b886d745ada3b8481e041ceca579c6f3acbea3 (diff)
downloadiproute2-bc5468c5ebc5085b931b2d0e73702b977d25c5f4.tar.gz
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@hrntknr.net> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--tc/f_fw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tc/f_fw.c b/tc/f_fw.c
index fe99cd42e..5e72e526b 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;