Skip to contentSkip to conversation

tc: couple ouf action cookie printout fixes

PATCH Applied Jiri Pirko 2 participants 4 messages Nov 25, 2017 – Nov 26, 2017

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

cover tc: couple ouf action cookie printout fixes

From: Jiri Pirko <[email protected]>

Jiri Pirko (2):
tc: move action cookie print out of the stats if
tc: remove action cookie len from printout

 tc/m_action.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.9.5
author
#1 lore raw

PATCH 1/2 tc: move action cookie print out of the stats if

From: Jiri Pirko <[email protected]>

Cookie print was made dependent on show_stats for no good reason. Fix this bu pushing cookie print ot of the stats if.

Fixes fd8b3d2c1b9b ("actions: Add support for user cookies")
---
 tc/m_action.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
tc/m_action.c +8 -9
index 85f9e27..aa3aa52 100644
@@ -301,19 +301,18 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
 		return err;
 
 	if (show_stats && tb[TCA_ACT_STATS]) {
-
 		fprintf(f, "\tAction statistics:\n");
 		print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
-		if (tb[TCA_ACT_COOKIE]) {
-			int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
-			char b1[strsz * 2 + 1];
-
-			fprintf(f, "\n\tcookie len %d %s ", strsz,
-				hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
-					      strsz, b1, sizeof(b1)));
-		}
 		fprintf(f, "\n");
 	}
+	if (tb[TCA_ACT_COOKIE]) {
+		int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
+		char b1[strsz * 2 + 1];
+
+		fprintf(f, "\tcookie len %d %s\n", strsz,
+			hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
+				      strsz, b1, sizeof(b1)));
+	}
 
 	return 0;
 }
Signature · 1 line
2.9.5
author
#2 lore raw

PATCH 2/2 tc: remove action cookie len from printout

In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>

Make the output same as input and avoid printout of unnecessary len.

Fixes fd8b3d2c1b9b ("actions: Add support for user cookies")
---
 tc/m_action.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_action.c +1 -1
index aa3aa52..e6d9149 100644
@@ -309,7 +309,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
 		int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
 		char b1[strsz * 2 + 1];
 
-		fprintf(f, "\tcookie len %d %s\n", strsz,
+		fprintf(f, "\tcookie %s\n",
 			hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
 				      strsz, b1, sizeof(b1)));
 	}
Signature · 1 line
2.9.5
#3 lore raw
In reply to Jiri Pirko
Quoted 9 lines · On Sat, 25 Nov 2017 11:07:55 +0100 Jiri Pirko <[email protected]> wrote:

From: Jiri Pirko <[email protected]>

Jiri Pirko (2):
tc: move action cookie print out of the stats if
tc: remove action cookie len from printout

 tc/m_action.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Applied, thanks Jiri