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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180502202801.5255-4-stephen@networkplumber.org>
Date:   Wed,  2 May 2018 13:27:59 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     netdev@...r.kernel.org
Cc:     Stephen Hemminger <sthemmin@...rosoft.com>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: [RFC iproute2-next 3/5] ss: use sockstat to get TCP bind ports

From: Stephen Hemminger <sthemmin@...rosoft.com>

Using slabinfo to try and get the number of bind_buckets no longer
works because of slab cache merging. Instead use proposed enhancment
of /proc/net/sockstat to get the same data.

Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 misc/ss.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index c88a25581755..4f76999c0fee 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -732,7 +732,6 @@ next:
 
 struct slabstat {
 	int socks;
-	int tcp_ports;
 	int tcp_tws;
 	int tcp_syns;
 	int skbs;
@@ -748,7 +747,6 @@ static int get_slabstat(struct slabstat *s)
 	static int slabstat_valid;
 	static const char * const slabstat_ids[] = {
 		"sock",
-		"tcp_bind_bucket",
 		"tcp_tw_bucket",
 		"tcp_open_request",
 		"skbuff_head_cache",
@@ -4594,6 +4592,7 @@ struct ssummary {
 	int tcp_orphans;
 	int tcp_tws;
 	int tcp4_hashed;
+	int tcp_ports;
 	int udp4;
 	int raw4;
 	int frag4;
@@ -4629,9 +4628,9 @@ static void get_sockstat_line(char *line, struct ssummary *s)
 	else if (strcmp(id, "FRAG6:") == 0)
 		sscanf(rem, "%*s%d%*s%d", &s->frag6, &s->frag6_mem);
 	else if (strcmp(id, "TCP:") == 0)
-		sscanf(rem, "%*s%d%*s%d%*s%d%*s%d%*s%ld",
+		sscanf(rem, "%*s%d%*s%d%*s%d%*s%d%*s%ld%*s%d",
 		       &s->tcp4_hashed,
-		       &s->tcp_orphans, &s->tcp_tws, &s->tcp_total, &s->tcp_mem);
+		       &s->tcp_orphans, &s->tcp_tws, &s->tcp_total, &s->tcp_mem, &s->tcp_ports);
 }
 
 static int get_sockstat(struct ssummary *s)
@@ -4676,8 +4675,7 @@ static int print_summary(void)
 	       s.tcp_total - (s.tcp4_hashed+s.tcp6_hashed-s.tcp_tws),
 	       s.tcp_orphans,
 	       slabstat.tcp_syns,
-	       s.tcp_tws, slabstat.tcp_tws,
-	       slabstat.tcp_ports
+	       s.tcp_tws, slabstat.tcp_tws, s.tcp_ports
 	       );
 
 	printf("\n");
-- 
2.17.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ