From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH iproute2-next 1/1] tc: jsonify skbedit action Date: Sun, 8 Apr 2018 11:50:56 -0600 Message-ID: References: <1522783461-14269-1-git-send-email-mrv@mojatatu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: stephen@networkplumber.org, netdev@vger.kernel.org, kernel@mojatatu.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us To: Roman Mashak , dsahern@gmail.com Return-path: Received: from mail-pf0-f180.google.com ([209.85.192.180]:43935 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbeDHRu7 (ORCPT ); Sun, 8 Apr 2018 13:50:59 -0400 Received: by mail-pf0-f180.google.com with SMTP id j2so4347092pff.10 for ; Sun, 08 Apr 2018 10:50:59 -0700 (PDT) In-Reply-To: <1522783461-14269-1-git-send-email-mrv@mojatatu.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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