]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/m_csum.c
tc: add 'kind' property to 'csum' action
[mirror_iproute2.git] / tc / m_csum.c
index 8391071d73f2396ed30c426790cac82e4dfbd4fb..84396d6a482df9216d22de5778d48c70ce9cab2e 100644 (file)
@@ -162,6 +162,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
        char *uflag_5 = "";
        char *uflag_6 = "";
        char *uflag_7 = "";
+       SPRINT_BUF(buf);
 
        int uflag_count = 0;
 
@@ -198,12 +199,16 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
                uflag_1 = "?empty";
        }
 
-       fprintf(f, "csum (%s%s%s%s%s%s%s) ",
-               uflag_1, uflag_2, uflag_3,
-               uflag_4, uflag_5, uflag_6, uflag_7);
+       print_string(PRINT_ANY, "kind", "%s ", "csum");
+       snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
+                uflag_1, uflag_2, uflag_3,
+                uflag_4, uflag_5, uflag_6, uflag_7);
+       print_string(PRINT_ANY, "csum", "(%s) ", buf);
+
        print_action_control(f, "action ", sel->action, "\n");
-       fprintf(f, "\tindex %u ref %d bind %d", sel->index, sel->refcnt,
-               sel->bindcnt);
+       print_uint(PRINT_ANY, "index", "\tindex %u", sel->index);
+       print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
+       print_int(PRINT_ANY, "bind", " bind %d", sel->bindcnt);
 
        if (show_stats) {
                if (tb[TCA_CSUM_TM]) {
@@ -212,7 +217,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
                        print_tm(f, tm);
                }
        }
-       fprintf(f, "\n");
+       print_string(PRINT_FP, NULL, "%s", "\n");
 
        return 0;
 }