diff options
Diffstat (limited to '')
-rw-r--r-- | tc/m_skbmod.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c index b1c8d00..af64e99 100644 --- a/tc/m_skbmod.c +++ b/tc/m_skbmod.c @@ -40,7 +40,7 @@ static void skbmod_usage(void) exit(-1); } -static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_skbmod(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { int argc = *argc_p; @@ -156,7 +156,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p, return 0; } -static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg) +static int print_skbmod(const struct action_util *au, FILE *f, struct rtattr *arg) { struct tc_skbmod *p; struct rtattr *tb[TCA_SKBMOD_MAX + 1]; @@ -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; } |