From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Mashak Subject: Re: [PATCH iproute2-next 1/1] tc: jsonify skbedit action Date: Mon, 09 Apr 2018 13:57:29 -0400 Message-ID: <85r2no1cvq.fsf@mojatatu.com> References: <1522783461-14269-1-git-send-email-mrv@mojatatu.com> Mime-Version: 1.0 Content-Type: text/plain Cc: stephen@networkplumber.org, netdev@vger.kernel.org, kernel@mojatatu.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us To: David Ahern Return-path: Received: from mail-it0-f41.google.com ([209.85.214.41]:34937 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbeDIR5c (ORCPT ); Mon, 9 Apr 2018 13:57:32 -0400 Received: by mail-it0-f41.google.com with SMTP id v194-v6so11387941itb.0 for ; Mon, 09 Apr 2018 10:57:32 -0700 (PDT) In-Reply-To: (David Ahern's message of "Sun, 8 Apr 2018 11:50:56 -0600") Sender: netdev-owner@vger.kernel.org List-ID: David Ahern 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.