On 4/3/18 1:24 PM, Roman Mashak wrote: > if (tb[TCA_SKBEDIT_PTYPE] != NULL) { > - ptype = RTA_DATA(tb[TCA_SKBEDIT_PTYPE]); > - if (*ptype == PACKET_HOST) > - fprintf(f, " ptype host"); > - else if (*ptype == PACKET_BROADCAST) > - fprintf(f, " ptype broadcast"); > - else if (*ptype == PACKET_MULTICAST) > - fprintf(f, " ptype multicast"); > - else if (*ptype == PACKET_OTHERHOST) > - fprintf(f, " ptype otherhost"); > + ptype = rta_getattr_u16(tb[TCA_SKBEDIT_PTYPE]); > + if (ptype == PACKET_HOST) > + print_string(PRINT_ANY, "ptype", " %s", "ptype host"); > + else if (ptype == PACKET_BROADCAST) > + print_string(PRINT_ANY, "ptype", " %s", > + "ptype broadcast"); > + else if (ptype == PACKET_MULTICAST) > + print_string(PRINT_ANY, "ptype", " %s", > + "ptype multicast"); > + else if (ptype == PACKET_OTHERHOST) > + print_string(PRINT_ANY, "ptype", " %s", > + "ptype otherhost");
Shouldn't that be: print_string(PRINT_ANY, "ptype", "ptype %s", "otherhost"); And ditto for the other strings. > else > - fprintf(f, " ptype %d", *ptype); > + print_uint(PRINT_ANY, "ptype", " %u", ptype); And then this one needs 'ptype' before %u