|
|
99be8f |
From ca6a2e6f21fc48b494216a095f5bd792a0c6e35d Mon Sep 17 00:00:00 2001
|
|
|
99be8f |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
99be8f |
Date: Mon, 29 Apr 2019 20:08:08 +0200
|
|
|
99be8f |
Subject: [PATCH] ss: Make struct tcpstat fields 'timer' and 'timeout' unsigned
|
|
|
99be8f |
|
|
|
99be8f |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
|
|
|
99be8f |
Upstream Status: iproute2.git commit 4cbf5224f2b50
|
|
|
99be8f |
|
|
|
99be8f |
commit 4cbf5224f2b50a24e1873508e7a0f1f81cc81a81
|
|
|
99be8f |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
99be8f |
Date: Thu Aug 24 11:41:26 2017 +0200
|
|
|
99be8f |
|
|
|
99be8f |
ss: Make struct tcpstat fields 'timer' and 'timeout' unsigned
|
|
|
99be8f |
|
|
|
99be8f |
Both 'timer' and 'timeout' variables of struct tcpstat are either
|
|
|
99be8f |
scanned as unsigned values from /proc/net/tcp{,6} or copied from
|
|
|
99be8f |
'idiag_timer' and 'idiag_expries' fields of struct inet_diag_msg, which
|
|
|
99be8f |
itself are unsigned. Therefore they may be unsigned as well, which
|
|
|
99be8f |
eliminates the need to check for negative values.
|
|
|
99be8f |
|
|
|
99be8f |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
99be8f |
---
|
|
|
99be8f |
misc/ss.c | 8 +++-----
|
|
|
99be8f |
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
99be8f |
|
|
|
99be8f |
diff --git a/misc/ss.c b/misc/ss.c
|
|
|
99be8f |
index 7a38e9d830e8d..2a981d8b06918 100644
|
|
|
99be8f |
--- a/misc/ss.c
|
|
|
99be8f |
+++ b/misc/ss.c
|
|
|
99be8f |
@@ -716,8 +716,8 @@ struct dctcpstat {
|
|
|
99be8f |
|
|
|
99be8f |
struct tcpstat {
|
|
|
99be8f |
struct sockstat ss;
|
|
|
99be8f |
- int timer;
|
|
|
99be8f |
- int timeout;
|
|
|
99be8f |
+ unsigned int timer;
|
|
|
99be8f |
+ unsigned int timeout;
|
|
|
99be8f |
int probes;
|
|
|
99be8f |
char cong_alg[16];
|
|
|
99be8f |
double rto, ato, rtt, rttvar;
|
|
|
99be8f |
@@ -903,13 +903,11 @@ static void sock_addr_print(const char *addr, char *delim, const char *port,
|
|
|
99be8f |
sock_addr_print_width(addr_width, addr, delim, serv_width, port, ifname);
|
|
|
99be8f |
}
|
|
|
99be8f |
|
|
|
99be8f |
-static const char *print_ms_timer(int timeout)
|
|
|
99be8f |
+static const char *print_ms_timer(unsigned int timeout)
|
|
|
99be8f |
{
|
|
|
99be8f |
static char buf[64];
|
|
|
99be8f |
int secs, msecs, minutes;
|
|
|
99be8f |
|
|
|
99be8f |
- if (timeout < 0)
|
|
|
99be8f |
- timeout = 0;
|
|
|
99be8f |
secs = timeout/1000;
|
|
|
99be8f |
minutes = secs/60;
|
|
|
99be8f |
secs = secs%60;
|
|
|
99be8f |
--
|
|
|
99be8f |
2.20.1
|
|
|
99be8f |
|