]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: jsonify connmark action
authorRoman Mashak <mrv@mojatatu.com>
Tue, 3 Apr 2018 13:09:55 +0000 (09:09 -0400)
committerDavid Ahern <dsahern@gmail.com>
Sun, 8 Apr 2018 17:52:32 +0000 (10:52 -0700)
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
tc/m_connmark.c

index bcce413913984ad7ce7ac43db4137c3dd207ee61..45e2d05f1a9114f7df37c88ee79a11e109390bf8 100644 (file)
@@ -114,16 +114,20 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
 
        parse_rtattr_nested(tb, TCA_CONNMARK_MAX, arg);
        if (tb[TCA_CONNMARK_PARMS] == NULL) {
-               fprintf(f, "[NULL connmark parameters]");
+               print_string(PRINT_FP, NULL, "%s", "[NULL connmark parameters]");
                return -1;
        }
 
        ci = RTA_DATA(tb[TCA_CONNMARK_PARMS]);
 
-       fprintf(f, " connmark zone %d", ci->zone);
-       print_action_control(f, " ", ci->action, "\n");
-       fprintf(f, "\t index %u ref %d bind %d", ci->index,
-               ci->refcnt, ci->bindcnt);
+       print_string(PRINT_ANY, "kind", "%s ", "connmark");
+       print_uint(PRINT_ANY, "zone", "zone %u", ci->zone);
+       print_action_control(f, " ", ci->action, "");
+
+       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
+       print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt);
+       print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt);
 
        if (show_stats) {
                if (tb[TCA_CONNMARK_TM]) {
@@ -132,7 +136,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
                        print_tm(f, tm);
                }
        }
-       fprintf(f, "\n");
+       print_string(PRINT_FP, NULL, "%s", _SL_);
 
        return 0;
 }