naccyde / rpms / iproute

Forked from rpms/iproute 4 months ago
Clone
Blob Blame History Raw
From e1383085284f283538af8598c52401b7d5906164 Mon Sep 17 00:00:00 2001
From: Andrea Claudi <aclaudi@redhat.com>
Date: Mon, 8 Jun 2020 14:50:35 +0200
Subject: [PATCH] tc_util: Fix format of TCA_STATS_BASIC_HW statistics

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1637437
Upstream Status: RHEL-only

During the backport of commit 5ac138324e31c ("tc_util: Add support for showing
TCA_STATS_BASIC_HW statistics") some code was modified to avoid backporting a
large unrelated commit jsonifing the output of tc stats.

The format of TCA_STATS_BASIC_HW statistics was unintentionally altered missing
a newline at the beginning of "Sent software" and "Sent hardware" lines.

This commit fix the output format.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 tc/tc_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tc/tc_util.c b/tc/tc_util.c
index ecc6fa1cca5f1..28dc06ffac784 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -714,13 +714,13 @@ static void print_tcstats_basic_hw(FILE *f, struct rtattr **tbs, char *prefix)
 			   sizeof(bs)));
 
 		if (bs.bytes >= bs_hw.bytes && bs.packets >= bs_hw.packets) {
-			fprintf(f, "%s", prefix);
+			fprintf(f, "\n%s", prefix);
 			fprintf(f, "Sent software %llu bytes", bs.bytes - bs_hw.bytes);
 			fprintf(f, " %u pkt", bs.packets - bs_hw.packets);
 		}
 	}
 
-	fprintf(f, "%s", prefix);
+	fprintf(f, "\n%s", prefix);
 	fprintf(f, "Sent hardware %llu bytes", bs_hw.bytes);
 	fprintf(f, " %u pkt", bs_hw.packets);
 }
-- 
2.26.2