summaryrefslogtreecommitdiff
path: root/usr.bin/netstat
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
parent66536bbecf14bbdbc330602326d5feb78103e6ff (diff)
IPComp support. angelos@ ok.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c46
-rw-r--r--usr.bin/netstat/main.c8
-rw-r--r--usr.bin/netstat/netstat.h3
3 files changed, 52 insertions, 5 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
+}
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index a5a1f192bc1..2e7e2da34ca 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.25 2001/05/18 02:41:38 provos Exp $ */
+/* $OpenBSD: main.c,v 1.26 2001/07/05 08:47:44 jjbg Exp $ */
/* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ char copyright[] =
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
-static char *rcsid = "$OpenBSD: main.c,v 1.25 2001/05/18 02:41:38 provos Exp $";
+static char *rcsid = "$OpenBSD: main.c,v 1.26 2001/07/05 08:47:44 jjbg Exp $";
#endif
#endif /* not lint */
@@ -175,6 +175,8 @@ struct nlist nl[] = {
{ "_mbpool" },
#define N_MCLPOOL 52
{ "_mclpool" },
+#define N_IPCOMPSTAT 53
+ { "_ipcompstat" },
{ ""},
};
@@ -204,6 +206,8 @@ struct protox {
ipip_stats, "ipencap" },
{ -1, N_ETHERIPSTAT, 1, 0,
etherip_stats,"etherip" },
+ { -1, N_IPCOMPSTAT, 1, 0,
+ ipcomp_stats, "ipcomp" },
{ -1, -1, 0, 0,
0, 0 }
};
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 7a4a9299925..879499aa7a4 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netstat.h,v 1.17 2001/05/18 02:41:38 provos Exp $ */
+/* $OpenBSD: netstat.h,v 1.18 2001/07/05 08:47:44 jjbg Exp $ */
/* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */
/*
@@ -83,6 +83,7 @@ void esp_stats __P((u_long, char *));
void ipip_stats __P((u_long, char *));
void etherip_stats __P((u_long, char *));
void protopr __P((u_long, char *));
+void ipcomp_stats __P((u_long, char *));
void mbpr(u_long, u_long, u_long);