From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action Date: Tue, 27 Mar 2018 15:07:13 -0700 Message-ID: <20180327150713.74c36a91@xeon-e3> References: <1521570107-30024-1-git-send-email-mrv@mojatatu.com> <20180327090554.44e7c9e2@xeon-e3> <85y3idi4r4.fsf@mojatatu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us To: Roman Mashak Return-path: Received: from mail-pl0-f68.google.com ([209.85.160.68]:34851 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752125AbeC0WHQ (ORCPT ); Tue, 27 Mar 2018 18:07:16 -0400 Received: by mail-pl0-f68.google.com with SMTP id p9-v6so293003pls.2 for ; Tue, 27 Mar 2018 15:07:15 -0700 (PDT) In-Reply-To: <85y3idi4r4.fsf@mojatatu.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 27 Mar 2018 17:32:31 -0400 Roman Mashak wrote: > Stephen Hemminger writes: > > > On Tue, 20 Mar 2018 14:21:47 -0400 > > Roman Mashak wrote: > > > >> Signed-off-by: Roman Mashak > >> --- > >> tc/m_nat.c | 5 +++++ > >> 1 file changed, 5 insertions(+) > >> > >> diff --git a/tc/m_nat.c b/tc/m_nat.c > >> index 1e4ff51fe75a..f6e373957c1b 100644 > >> --- a/tc/m_nat.c > >> +++ b/tc/m_nat.c > >> @@ -169,6 +169,9 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg) > >> format_host_r(AF_INET, 4, &sel->new_addr, buf2, sizeof(buf2))); > >> print_action_control(f, " ", sel->action, ""); > >> > >> + fprintf(f, "\n\t index %u ref %d bind %d", > >> + sel->index, sel->refcnt, sel->bindcnt); > >> + > >> if (show_stats) { > >> if (tb[TCA_NAT_TM]) { > >> struct tcf_t *tm = RTA_DATA(tb[TCA_NAT_TM]); > >> @@ -177,6 +180,8 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg) > >> } > >> } > >> > >> + fprintf(f, "\n"); > >> + > >> return 0; > >> } > > > > Rather than printing newline all the time, you need to use _SL_ to keep the optional > > oneline output format. > > > > I.e > > fprintf(f, "%s\t index %u ref %d bind %d", > > _SL_, sel->index, sel->refcnt, sel->bindcnt); > > tc currently doesn't support oneline mode, so I'll have to add it first, > then update all actions to use the oneliner. I will take the original patch set then for the tc stuff.