[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85r2no1cvq.fsf@mojatatu.com>
Date: Mon, 09 Apr 2018 13:57:29 -0400
From: Roman Mashak <mrv@...atatu.com>
To: David Ahern <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
David Ahern <dsahern@...il.com> writes:
> 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
OK. I will send v2.
Powered by blists - more mailing lists