lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190702065339.18735-1-tomasz.torcz@nordea.com>
Date:   Tue, 2 Jul 2019 08:53:39 +0200
From:   Tomasz Torcz <tomasz.torcz@...dea.com>
To:     <dsahern@...il.com>
CC:     <netdev@...r.kernel.org>, Tomasz Torcz <tomasz.torcz@...dea.com>
Subject: [PATCH] ss: in --numeric mode, print raw numbers for data rates

  ss by default shows data rates in human-readable form - as Mbps/Gbps etc.
 Enhance --numeric mode to show raw values in bps, without conversion.

  Signed-of-by: Tomasz Torcz <tomasz.torcz@...dea.com>
---
 man/man8/ss.8 | 2 +-
 misc/ss.c     | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/man/man8/ss.8 b/man/man8/ss.8
index 9054fab9..f428e60c 100644
--- a/man/man8/ss.8
+++ b/man/man8/ss.8
@@ -28,7 +28,7 @@ Suppress header line.
 Print each socket's data on a single line.
 .TP
 .B \-n, \-\-numeric
-Do not try to resolve service names.
+Do not try to resolve service names. Show exact bandwidth values, instead of human-readable.
 .TP
 .B \-r, \-\-resolve
 Try to resolve numeric address/ports.
diff --git a/misc/ss.c b/misc/ss.c
index 99c06d31..3d9d1d8f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2361,7 +2361,9 @@ static int proc_inet_split_line(char *line, char **loc, char **rem, char **data)
 
 static char *sprint_bw(char *buf, double bw)
 {
-	if (bw > 1000000.)
+	if (!resolve_services)
+		sprintf(buf, "%.0f", bw);
+	else if (bw > 1000000.)
 		sprintf(buf, "%.1fM", bw / 1000000.);
 	else if (bw > 1000.)
 		sprintf(buf, "%.1fK", bw / 1000.);
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ