netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action
@ 2018-03-20 18:21 Roman Mashak
  2018-03-27 16:05 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Roman Mashak @ 2018-03-20 18:21 UTC (permalink / raw)
  To: stephen; +Cc: netdev, jhs, xiyou.wangcong, jiri, Roman Mashak

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 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;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action
  2018-03-20 18:21 [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action Roman Mashak
@ 2018-03-27 16:05 ` Stephen Hemminger
  2018-03-27 21:32   ` Roman Mashak
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2018-03-27 16:05 UTC (permalink / raw)
  To: Roman Mashak; +Cc: netdev, jhs, xiyou.wangcong, jiri

On Tue, 20 Mar 2018 14:21:47 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> ---
>  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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action
  2018-03-27 16:05 ` Stephen Hemminger
@ 2018-03-27 21:32   ` Roman Mashak
  2018-03-27 22:06     ` Stephen Hemminger
  2018-03-27 22:07     ` Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: Roman Mashak @ 2018-03-27 21:32 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, jhs, xiyou.wangcong, jiri

Stephen Hemminger <stephen@networkplumber.org> writes:

> On Tue, 20 Mar 2018 14:21:47 -0400
> Roman Mashak <mrv@mojatatu.com> wrote:
>
>> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
>> ---
>>  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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action
  2018-03-27 21:32   ` Roman Mashak
@ 2018-03-27 22:06     ` Stephen Hemminger
  2018-03-27 22:07     ` Stephen Hemminger
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2018-03-27 22:06 UTC (permalink / raw)
  To: Roman Mashak; +Cc: netdev, jhs, xiyou.wangcong, jiri

On Tue, 27 Mar 2018 17:32:31 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> Stephen Hemminger <stephen@networkplumber.org> writes:
> 
> > On Tue, 20 Mar 2018 14:21:47 -0400
> > Roman Mashak <mrv@mojatatu.com> wrote:
> >  
> >> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> >> ---
> >>  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.

Ok, never mind then. Let's just get to it as part of the JSON work.
I spent too much staring at ip ...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action
  2018-03-27 21:32   ` Roman Mashak
  2018-03-27 22:06     ` Stephen Hemminger
@ 2018-03-27 22:07     ` Stephen Hemminger
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2018-03-27 22:07 UTC (permalink / raw)
  To: Roman Mashak; +Cc: netdev, jhs, xiyou.wangcong, jiri

On Tue, 27 Mar 2018 17:32:31 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> Stephen Hemminger <stephen@networkplumber.org> writes:
> 
> > On Tue, 20 Mar 2018 14:21:47 -0400
> > Roman Mashak <mrv@mojatatu.com> wrote:
> >  
> >> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> >> ---
> >>  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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-27 22:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-20 18:21 [PATCH iproute2 1/1] tc: print index, refcnt & bindcnt for nat action Roman Mashak
2018-03-27 16:05 ` Stephen Hemminger
2018-03-27 21:32   ` Roman Mashak
2018-03-27 22:06     ` Stephen Hemminger
2018-03-27 22:07     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).