[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f38705ad-38d0-9e65-510c-c71095e5afd8@gmail.com>
Date: Sun, 8 Apr 2018 11:50:56 -0600
From: David Ahern <dsahern@...il.com>
To: Roman Mashak <mrv@...atatu.com>, dsahern@...il.com
Cc: stephen@...workplumber.org, netdev@...r.kernel.org,
kernel@...atatu.com, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us
Subject: Re: [PATCH iproute2-next 1/1] tc: jsonify skbedit action
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
Powered by blists - more mailing lists