Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat Tweak outputs of netstat -s for IPsec
details: https://anonhg.NetBSD.org/src/rev/f202d111124e
branches: trunk
changeset: 354770:f202d111124e
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Jun 29 07:15:27 2017 +0000
description:
Tweak outputs of netstat -s for IPsec
- Get rid of "Fast"
- Use ipsec and ipsec6 for titles to clarify protocol
- Indent outputs of sub protocols
Original outputs were organized like this:
(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:
(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:
New outputs are organized like this:
ipsec:
ah:
esp:
ipip:
ipcomp:
ipsec6:
ah:
esp:
ipip:
ipcomp:
diffstat:
usr.bin/netstat/fast_ipsec.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diffs (87 lines):
diff -r 9f6521a1c18c -r f202d111124e usr.bin/netstat/fast_ipsec.c
--- a/usr.bin/netstat/fast_ipsec.c Thu Jun 29 07:13:41 2017 +0000
+++ b/usr.bin/netstat/fast_ipsec.c Thu Jun 29 07:15:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fast_ipsec.c,v 1.21 2017/04/13 16:38:32 christos Exp $ */
+/* $NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $ */
/* $FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $ */
/*-
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
#ifdef __NetBSD__
-__RCSID("$NetBSD: fast_ipsec.c,v 1.21 2017/04/13 16:38:32 christos Exp $");
+__RCSID("$NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $");
#endif
#endif /* not lint*/
@@ -145,7 +145,7 @@
if (status < 0 && errno != ENOMEM)
err(1, "net.inet.ipip.ipip_stats");
- printf("(Fast) IPsec:\n");
+ printf("%s:\n", name);
#define STAT(x,fmt) if ((x) || sflag <= 1) printf("\t%"PRIu64" " fmt "\n", x)
if (ipsecstats[IPSEC_STAT_IN_POLVIO]+ipsecstats[IPSEC_STAT_OUT_POLVIO])
@@ -160,10 +160,9 @@
STAT(ipsecstats[IPSEC_STAT_SPDCACHELOOKUP], "SPD cache lookups");
STAT(ipsecstats[IPSEC_STAT_SPDCACHEMISS], "SPD cache misses");
#undef STAT
- printf("\n");
- printf("IPsec ah:\n");
-#define AHSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t%"PRIu64" ah " fmt "\n", x)
+ printf("\tah:\n");
+#define AHSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ah " fmt "\n", x)
AHSTAT(ahstats[AH_STAT_INPUT], "input packets processed");
AHSTAT(ahstats[AH_STAT_OUTPUT], "output packets processed");
AHSTAT(ahstats[AH_STAT_HDROPS], "headers too short");
@@ -192,10 +191,9 @@
AHSTAT(ahstats[AH_STAT_IBYTES], "bytes received");
AHSTAT(ahstats[AH_STAT_OBYTES], "bytes transmitted");
#undef AHSTAT
- printf("\n");
- printf("IPsec esp:\n");
-#define ESPSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t%"PRIu64" esp " fmt "\n", x)
+ printf("\tesp:\n");
+#define ESPSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t\t%"PRIu64" esp " fmt "\n", x)
ESPSTAT(espstats[ESP_STAT_INPUT],"input packets processed");
ESPSTAT(espstats[ESP_STAT_OUTPUT],"output packets processed");
ESPSTAT(espstats[ESP_STAT_HDROPS],"headers too short");
@@ -224,10 +222,10 @@
ESPSTAT(espstats[ESP_STAT_IBYTES], "bytes received");
ESPSTAT(espstats[ESP_STAT_OBYTES], "bytes transmitted");
#undef ESPSTAT
- printf("IPsec ipip:\n");
+ printf("\tipip:\n");
#define IPIPSTAT(x,fmt) \
- if ((x) || sflag <= 1) printf("\t%"PRIu64" ipip " fmt "\n", x)
+ if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ipip " fmt "\n", x)
IPIPSTAT(ipips[IPIP_STAT_IPACKETS],"total input packets");
IPIPSTAT(ipips[IPIP_STAT_OPACKETS],"total output packets");
IPIPSTAT(ipips[IPIP_STAT_HDROPS],"packets too short for header length");
@@ -240,9 +238,9 @@
IPIPSTAT(ipips[IPIP_STAT_OBYTES],"output bytes processed");
#undef IPIPSTAT
- printf("IPsec ipcomp:\n");
+ printf("\tipcomp:\n");
#define IPCOMP(x,fmt) \
- if ((x) || sflag <= 1) printf("\t%"PRIu64" ipcomp " fmt "\n", x)
+ if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ipcomp " fmt "\n", x)
IPCOMP(ipcs[IPCOMP_STAT_HDROPS],"packets too short for header length");
IPCOMP(ipcs[IPCOMP_STAT_NOPF], "protocol family not supported");
@@ -260,7 +258,7 @@
IPCOMP(ipcs[IPCOMP_STAT_PDROPS],"packets blocked due to policy");
IPCOMP(ipcs[IPCOMP_STAT_CRYPTO],"failed crypto requests");
- printf("\tIPcomp histogram:\n");
+ printf("\tipcomp histogram:\n");
for (i = 0; i < IPCOMP_ALG_MAX; i++)
if (ipcs[IPCOMP_STAT_HIST + i])
printf("\t\tIPcomp packets with %s: %"PRIu64"\n"
Home |
Main Index |
Thread Index |
Old Index