@@ -177,43 +177,48 @@ static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
p = RTA_DATA(tb[TCA_SKBMOD_PARMS]);
- fprintf(f, "skbmod ");
+ print_string(PRINT_FP, NULL, "skbmod ", NULL);
print_action_control(f, "", p->action, " ");
if (tb[TCA_SKBMOD_ETYPE]) {
skbmod_etype = rta_getattr_u16(tb[TCA_SKBMOD_ETYPE]);
has_optional = 1;
- fprintf(f, "set etype 0x%X ", skbmod_etype);
+ print_0xhex(PRINT_ANY, "etype", "set etype 0x%X ", skbmod_etype);
}
if (has_optional)
- fprintf(f, "\n\t ");
+ print_string(PRINT_FP, NULL, "%s\t ", _SL_);
if (tb[TCA_SKBMOD_DMAC]) {
has_optional = 1;
- fprintf(f, "set dmac %s ",
- ll_addr_n2a(RTA_DATA(tb[TCA_SKBMOD_DMAC]),
- RTA_PAYLOAD(tb[TCA_SKBMOD_DMAC]), 0, b1,
- sizeof(b1)));
+ print_color_string(PRINT_ANY, COLOR_MAC, "dmac",
+ "set dmac %s ",
+ ll_addr_n2a(RTA_DATA(tb[TCA_SKBMOD_DMAC]),
+ RTA_PAYLOAD(tb[TCA_SKBMOD_DMAC]), 0, b1,
+ sizeof(b1)));
}
if (tb[TCA_SKBMOD_SMAC]) {
has_optional = 1;
- fprintf(f, "set smac %s ",
- ll_addr_n2a(RTA_DATA(tb[TCA_SKBMOD_SMAC]),
- RTA_PAYLOAD(tb[TCA_SKBMOD_SMAC]), 0, b2,
- sizeof(b2)));
+ print_color_string(PRINT_ANY, COLOR_MAC, "smac",
+ "set smac %s ",
+ ll_addr_n2a(RTA_DATA(tb[TCA_SKBMOD_SMAC]),
+ RTA_PAYLOAD(tb[TCA_SKBMOD_SMAC]), 0, b2,
+ sizeof(b2)));
}
if (p->flags & SKBMOD_F_SWAPMAC)
- fprintf(f, "swap mac ");
+ print_null(PRINT_ANY, "swapmac", "swap mac ", NULL);
if (p->flags & SKBMOD_F_ECN)
- fprintf(f, "ecn ");
+ print_null(PRINT_ANY, "ecn", "ecn ", NULL);
+
+ print_nl();
+ print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
+ print_int(PRINT_ANY, "ref", "ref %d ", p->refcnt);
+ print_int(PRINT_ANY, "bind", "bind %d", p->bindcnt);
- fprintf(f, "\n\t index %u ref %d bind %d", p->index, p->refcnt,
- p->bindcnt);
if (show_stats) {
if (tb[TCA_SKBMOD_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_SKBMOD_TM]);
@@ -222,7 +227,7 @@ static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
}
}
- fprintf(f, "\n");
+ print_string(PRINT_FP, NULL, "\n", NULL);
return 0;
}
This tc action never got jsonized. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- tc/m_skbmod.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)