]> 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 7b156734f64c5581fe60fb7fdf012114b15971fd..84396d6a482df9216d22de5778d48c70ce9cab2e 100644 (file)
@@ -138,10 +138,9 @@ parse_csum(struct action_util *a, int *argc_p,
                }
        }
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+       tail = addattr_nest(n, MAX_MSG, tca_id);
        addattr_l(n, MAX_MSG, TCA_CSUM_PARMS, &sel, sizeof(sel));
-       tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
+       addattr_nest_end(n, tail);
 
        *argc_p = argc;
        *argv_p = argv;
@@ -163,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;
 
@@ -199,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]) {
@@ -213,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;
 }