summaryrefslogtreecommitdiff
path: root/usr.bin/netstat/inet.c
diff options
context:
space:
mode:
authorJean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org>2001-07-05 08:47:45 +0000
committerJean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org>2001-07-05 08:47:45 +0000
commite7879d1afa5b469a38b274c7d7bf4998fd5bbc35 (patch)
tree8b8764cf3b002336274255b98ec40a35ddd97695 /usr.bin/netstat/inet.c
parent66536bbecf14bbdbc330602326d5feb78103e6ff (diff)
IPComp support. angelos@ ok.
Diffstat (limited to 'usr.bin/netstat/inet.c')
-rw-r--r--usr.bin/netstat/inet.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index a59ecb569f1..3157adcbe40 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.50 2001/06/23 06:09:09 angelos Exp $ */
+/* $OpenBSD: inet.c,v 1.51 2001/07/05 08:47:43 jjbg Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: inet.c,v 1.50 2001/06/23 06:09:09 angelos Exp $";
+static char *rcsid = "$OpenBSD: inet.c,v 1.51 2001/07/05 08:47:43 jjbg Exp $";
#endif
#endif /* not lint */
@@ -833,3 +833,45 @@ ipip_stats(off, name)
p(ipips_unspec, "\t%u attempts to use tunnel with unspecified endpoint(s)\n");
#undef p
}
+
+/*
+ * Dump IPCOMP statistics structure.
+ */
+void
+ipcomp_stats(off, name)
+ u_long off;
+ char *name;
+{
+ struct ipcompstat ipcompstat;
+
+
+ if (off == 0)
+ return;
+ kread(off, (char *)&ipcompstat, sizeof (ipcompstat));
+ printf("%s:\n", name);
+
+#define p(f, m) if (ipcompstat.f || sflag <= 1) \
+ printf(m, ipcompstat.f, plural(ipcompstat.f))
+
+ p(ipcomps_input, "\t%u input IPCOMP packet%s\n");
+ p(ipcomps_output, "\t%u output IPCOMP packet%s\n");
+ p(ipcomps_nopf, "\t%u packet%s from unsupported protocol families\n");
+ p(ipcomps_hdrops, "\t%u packet%s shorter than header shows\n");
+ p(ipcomps_pdrops, "\t%u packet%s dropped due to policy\n");
+ p(ipcomps_notdb, "\t%u packet%s for which no TDB was found\n");
+ p(ipcomps_badkcr, "\t%u input packet%s that failed to be processed\n");
+ p(ipcomps_badenc, "\t%u packet%s with bad compression received\n");
+ p(ipcomps_badauth, "\t%u packet%s that failed verification received\n");
+ p(ipcomps_noxform, "\t%u packet%s for which no XFORM was set in TDB received\n");
+ p(ipcomps_qfull, "\t%u packet%s were dropped due to full output queue\n");
+ p(ipcomps_wrap, "\t%u packet%s where counter wrapping was detected\n");
+ p(ipcomps_replay, "\t%u possibly replayed packet%s received\n");
+ p(ipcomps_badilen, "\t%u packet%s with bad payload size or padding received\n");
+ p(ipcomps_invalid, "\t%u packet%s attempted to use an invalid tdb\n");
+ p(ipcomps_toobig, "\t%u packet%s got larger than max IP packet size\n");
+ p(ipcomps_crypto, "\t%u packet%s that failed (de)compression processing\n");
+ p(ipcomps_ibytes, "\t%qu input byte%s\n");
+ p(ipcomps_obytes, "\t%qu output byte%s\n");
+
+#undef p
+}