linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0001-misc-ss-tcp-cwnd-should-be-unsigned.patch

4aca6e
From f9a228a373bc7dc77a7ddc5c601c801c8e8498aa Mon Sep 17 00:00:00 2001
4aca6e
From: Davide Caratti <dcaratti@redhat.com>
4aca6e
Date: Fri, 18 Nov 2016 11:45:54 +0100
4aca6e
Subject: [PATCH] misc/ss: tcp cwnd should be unsigned
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375215
4aca6e
Upstream Status: iproute2.git commit d1f338b31858
4aca6e
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12041044
4aca6e
Tested: on local VM using iperf3 on loopback
4aca6e
4aca6e
commit d1f338b31858005b2550da05098d56ea4e8fd401
4aca6e
Author: Hangbin Liu <liuhangbin@gmail.com>
4aca6e
Date:   Thu Sep 22 16:40:28 2016 +0800
4aca6e
4aca6e
    misc/ss: tcp cwnd should be unsigned
4aca6e
4aca6e
    tcp->snd_cwd is a u32, but ss treats it like a signed int. This may
4aca6e
    results in negative bandwidth calculations.
4aca6e
4aca6e
    Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
4aca6e
    Acked-by: Phil Sutter <phil@nwl.cc>
4aca6e
4aca6e
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
4aca6e
---
4aca6e
 misc/ss.c | 7 ++++---
4aca6e
 1 file changed, 4 insertions(+), 3 deletions(-)
4aca6e
4aca6e
diff --git a/misc/ss.c b/misc/ss.c
4aca6e
index c385d47..45fb4b0 100644
4aca6e
--- a/misc/ss.c
4aca6e
+++ b/misc/ss.c
4aca6e
@@ -759,11 +759,12 @@ struct tcpstat
4aca6e
 	int		    probes;
4aca6e
 	char		    cong_alg[16];
4aca6e
 	double		    rto, ato, rtt, rttvar;
4aca6e
-	int		    qack, cwnd, ssthresh, backoff;
4aca6e
+	int		    qack, ssthresh, backoff;
4aca6e
 	double		    send_bps;
4aca6e
 	int		    snd_wscale;
4aca6e
 	int		    rcv_wscale;
4aca6e
 	int		    mss;
4aca6e
+	unsigned int	    cwnd;
4aca6e
 	unsigned int	    lastsnd;
4aca6e
 	unsigned int	    lastrcv;
4aca6e
 	unsigned int	    lastack;
4aca6e
@@ -1692,7 +1693,7 @@ static void tcp_stats_print(struct tcpstat *s)
4aca6e
 	if (s->mss)
4aca6e
 		printf(" mss:%d", s->mss);
4aca6e
 	if (s->cwnd)
4aca6e
-		printf(" cwnd:%d", s->cwnd);
4aca6e
+		printf(" cwnd:%u", s->cwnd);
4aca6e
 	if (s->ssthresh)
4aca6e
 		printf(" ssthresh:%d", s->ssthresh);
4aca6e
 
4aca6e
@@ -1783,7 +1784,7 @@ static int tcp_show_line(char *line, const struct filter *f, int family)
4aca6e
 		return 0;
4aca6e
 
4aca6e
 	opt[0] = 0;
4aca6e
-	n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %d %d %[^\n]\n",
4aca6e
+	n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %u %d %[^\n]\n",
4aca6e
 		   &s.ss.state, &s.ss.wq, &s.ss.rq,
4aca6e
 		   &s.timer, &s.timeout, &s.retrans, &s.ss.uid, &s.probes,
4aca6e
 		   &s.ss.ino, &s.ss.refcnt, &s.ss.sk, &rto, &ato, &s.qack, &s.cwnd,
4aca6e
-- 
4aca6e
1.8.3.1
4aca6e