All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values
@ 2018-03-19 21:05 Roman Mashak
  2018-03-27 16:02 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Mashak @ 2018-03-19 21:05 UTC (permalink / raw)
  To: stephen; +Cc: netdev, jhs, xiyou.wangcong, jiri, Roman Mashak

v3:
   fixed conversion in connmark missed out in first version
v2:
   fixed coding style

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 tc/m_action.c     | 2 +-
 tc/m_connmark.c   | 2 +-
 tc/m_gact.c       | 2 +-
 tc/m_ife.c        | 2 +-
 tc/m_pedit.c      | 2 +-
 tc/m_sample.c     | 6 +++---
 tc/m_tunnel_key.c | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tc/m_action.c b/tc/m_action.c
index 148f1372d414..244c1ec00f28 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -408,7 +408,7 @@ int print_action(const struct sockaddr_nl *who,
 	if (tb[TCA_ROOT_COUNT])
 		tot_acts = RTA_DATA(tb[TCA_ROOT_COUNT]);
 
-	fprintf(fp, "total acts %d\n", tot_acts ? *tot_acts:0);
+	fprintf(fp, "total acts %u\n", tot_acts ? *tot_acts : 0);
 	if (tb[TCA_ACT_TAB] == NULL) {
 		if (n->nlmsg_type != RTM_GETACTION)
 			fprintf(stderr, "print_action: NULL kind\n");
diff --git a/tc/m_connmark.c b/tc/m_connmark.c
index 37d718541549..7c4ba7ae5301 100644
--- a/tc/m_connmark.c
+++ b/tc/m_connmark.c
@@ -121,7 +121,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
 
 	ci = RTA_DATA(tb[TCA_CONNMARK_PARMS]);
 
-	fprintf(f, " connmark zone %d\n", ci->zone);
+	fprintf(f, " connmark zone %u\n", ci->zone);
 	fprintf(f, "\t index %u ref %d bind %d", ci->index,
 		ci->refcnt, ci->bindcnt);
 
diff --git a/tc/m_gact.c b/tc/m_gact.c
index 16c4413f4217..52022415db48 100644
--- a/tc/m_gact.c
+++ b/tc/m_gact.c
@@ -194,7 +194,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
 	print_string(PRINT_ANY, "random_type", "\n\t random type %s",
 		     prob_n2a(pp->ptype));
 	print_action_control(f, " ", pp->paction, " ");
-	print_int(PRINT_ANY, "val", "val %d", pp->pval);
+	print_int(PRINT_ANY, "val", "val %u", pp->pval);
 	close_json_object();
 #endif
 	print_uint(PRINT_ANY, "index", "\n\t index %u", p->index);
diff --git a/tc/m_ife.c b/tc/m_ife.c
index 205efc9f1d9a..e1dbd3a79649 100644
--- a/tc/m_ife.c
+++ b/tc/m_ife.c
@@ -280,7 +280,7 @@ static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
 			if (len) {
 				mtcindex =
 					rta_getattr_u16(metalist[IFE_META_TCINDEX]);
-				fprintf(f, "use tcindex %d ", mtcindex);
+				fprintf(f, "use tcindex %u ", mtcindex);
 			} else
 				fprintf(f, "allow tcindex ");
 		}
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 26549eeea899..151dfe1a230a 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -817,7 +817,7 @@ int print_pedit(struct action_util *au, FILE *f, struct rtattr *arg)
 				(unsigned int)ntohl(key->mask));
 		}
 	} else {
-		fprintf(f, "\npedit %x keys %d is not LEGIT", sel->index,
+		fprintf(f, "\npedit %x keys %u is not LEGIT", sel->index,
 			sel->nkeys);
 	}
 
diff --git a/tc/m_sample.c b/tc/m_sample.c
index 01763cb4c356..d42a6a327965 100644
--- a/tc/m_sample.c
+++ b/tc/m_sample.c
@@ -155,17 +155,17 @@ static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
 	}
 	p = RTA_DATA(tb[TCA_SAMPLE_PARMS]);
 
-	fprintf(f, "sample rate 1/%d group %d",
+	fprintf(f, "sample rate 1/%u group %u",
 		rta_getattr_u32(tb[TCA_SAMPLE_RATE]),
 		rta_getattr_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]));
 
 	if (tb[TCA_SAMPLE_TRUNC_SIZE])
-		fprintf(f, " trunc_size %d",
+		fprintf(f, " trunc_size %u",
 			rta_getattr_u32(tb[TCA_SAMPLE_TRUNC_SIZE]));
 
 	print_action_control(f, " ", p->action, "");
 
-	fprintf(f, "\n\tindex %d ref %d bind %d", p->index, p->refcnt,
+	fprintf(f, "\n\tindex %u ref %d bind %d", p->index, p->refcnt,
 		p->bindcnt);
 
 	if (show_stats) {
diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
index 1cdd03560c35..dd8f8e8c635b 100644
--- a/tc/m_tunnel_key.c
+++ b/tc/m_tunnel_key.c
@@ -292,7 +292,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
 	}
 	print_action_control(f, " ", parm->action, "");
 
-	fprintf(f, "\n\tindex %d ref %d bind %d", parm->index, parm->refcnt,
+	fprintf(f, "\n\tindex %u ref %d bind %d", parm->index, parm->refcnt,
 		parm->bindcnt);
 
 	if (show_stats) {
-- 
2.7.4

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

* Re: [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values
  2018-03-19 21:05 [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values Roman Mashak
@ 2018-03-27 16:02 ` Stephen Hemminger
  2018-03-27 21:33   ` Roman Mashak
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2018-03-27 16:02 UTC (permalink / raw)
  To: Roman Mashak; +Cc: netdev, jhs, xiyou.wangcong, jiri

On Mon, 19 Mar 2018 17:05:41 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> diff --git a/tc/m_gact.c b/tc/m_gact.c
> index 16c4413f4217..52022415db48 100644
> --- a/tc/m_gact.c
> +++ b/tc/m_gact.c
> @@ -194,7 +194,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
>  	print_string(PRINT_ANY, "random_type", "\n\t random type %s",
>  		     prob_n2a(pp->ptype));
>  	print_action_control(f, " ", pp->paction, " ");
> -	print_int(PRINT_ANY, "val", "val %d", pp->pval);
> +	print_int(PRINT_ANY, "val", "val %u", pp->pval);
>  	close_json_object();

This needs to be print_uint in order to work correctly with json output.

Also, please consider doing json on all the match types in a later patch
for net-next.

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

* Re: [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values
  2018-03-27 16:02 ` Stephen Hemminger
@ 2018-03-27 21:33   ` Roman Mashak
  2018-03-27 21:56     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Mashak @ 2018-03-27 21:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, jhs, xiyou.wangcong, jiri

Stephen Hemminger <stephen@networkplumber.org> writes:

> On Mon, 19 Mar 2018 17:05:41 -0400
> Roman Mashak <mrv@mojatatu.com> wrote:
>
>> diff --git a/tc/m_gact.c b/tc/m_gact.c
>> index 16c4413f4217..52022415db48 100644
>> --- a/tc/m_gact.c
>> +++ b/tc/m_gact.c
>> @@ -194,7 +194,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
>>  	print_string(PRINT_ANY, "random_type", "\n\t random type %s",
>>  		     prob_n2a(pp->ptype));
>>  	print_action_control(f, " ", pp->paction, " ");
>> -	print_int(PRINT_ANY, "val", "val %d", pp->pval);
>> +	print_int(PRINT_ANY, "val", "val %u", pp->pval);
>>  	close_json_object();
>
> This needs to be print_uint in order to work correctly with json output.
>
> Also, please consider doing json on all the match types in a later patch
> for net-next.

Did you mean iproute2-next?

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

* Re: [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values
  2018-03-27 21:33   ` Roman Mashak
@ 2018-03-27 21:56     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-03-27 21:56 UTC (permalink / raw)
  To: Roman Mashak; +Cc: netdev, jhs, xiyou.wangcong, jiri

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

> Stephen Hemminger <stephen@networkplumber.org> writes:
> 
> > On Mon, 19 Mar 2018 17:05:41 -0400
> > Roman Mashak <mrv@mojatatu.com> wrote:
> >  
> >> diff --git a/tc/m_gact.c b/tc/m_gact.c
> >> index 16c4413f4217..52022415db48 100644
> >> --- a/tc/m_gact.c
> >> +++ b/tc/m_gact.c
> >> @@ -194,7 +194,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
> >>  	print_string(PRINT_ANY, "random_type", "\n\t random type %s",
> >>  		     prob_n2a(pp->ptype));
> >>  	print_action_control(f, " ", pp->paction, " ");
> >> -	print_int(PRINT_ANY, "val", "val %d", pp->pval);
> >> +	print_int(PRINT_ANY, "val", "val %u", pp->pval);
> >>  	close_json_object();  
> >
> > This needs to be print_uint in order to work correctly with json output.
> >
> > Also, please consider doing json on all the match types in a later patch
> > for net-next.  
> 
> Did you mean iproute2-next?

yes. iproute2-next for the JSON changes

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 21:05 [PATCH v3 iproute2 1/1] tc: fix conversion types when printing actions unsigned values Roman Mashak
2018-03-27 16:02 ` Stephen Hemminger
2018-03-27 21:33   ` Roman Mashak
2018-03-27 21:56     ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.