summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2001-10-18 09:26:16 +0000
committeritojun <itojun@NetBSD.org>2001-10-18 09:26:16 +0000
commitc868e666a2af46cc910c48cf35f3c09bbb09dd28 (patch)
tree08b4f0a70c9c315d151fec15c222e371a8f434ac
parent2c481876739ddea1ab0e4165645f428fd63e9fb6 (diff)
print rip6stat. sync with kame
-rw-r--r--usr.bin/netstat/inet6.c42
-rw-r--r--usr.bin/netstat/main.c8
-rw-r--r--usr.bin/netstat/netstat.h3
3 files changed, 48 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 6869dfa8bad..86558d564f1 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: inet6.c,v 1.22 2001/09/10 14:25:12 thorpej Exp $ */
+/* $NetBSD: inet6.c,v 1.23 2001/10/18 09:26:16 itojun Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
@@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-__RCSID("$NetBSD: inet6.c,v 1.22 2001/09/10 14:25:12 thorpej Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.23 2001/10/18 09:26:16 itojun Exp $");
#endif
#endif /* not lint */
@@ -117,6 +117,7 @@ extern char *tcpstates[];
#include <netinet6/udp6.h>
#include <netinet6/udp6_var.h>
#include <netinet6/pim6_var.h>
+#include <netinet6/raw_ip6.h>
#include <arpa/inet.h>
#if 0
@@ -1101,6 +1102,43 @@ pim6_stats(off, name)
}
/*
+ * Dump raw ip6 statistics structure.
+ */
+void
+rip6_stats(off, name)
+ u_long off;
+ char *name;
+{
+ struct rip6stat rip6stat;
+ u_quad_t delivered;
+
+ if (off == 0)
+ return;
+ kread(off, (char *)&rip6stat, sizeof(rip6stat));
+ printf("%s:\n", name);
+
+#define p(f, m) if (rip6stat.f || sflag <= 1) \
+ printf(m, (unsigned long long)rip6stat.f, plural(rip6stat.f))
+ p(rip6s_ipackets, "\t%llu message%s received\n");
+ p(rip6s_isum, "\t%llu checksum calcuration%s on inbound\n");
+ p(rip6s_badsum, "\t%llu message%s with bad checksum\n");
+ p(rip6s_nosock, "\t%llu message%s dropped due to no socket\n");
+ p(rip6s_nosockmcast,
+ "\t%llu multicast message%s dropped due to no socket\n");
+ p(rip6s_fullsock,
+ "\t%llu message%s dropped due to full socket buffers\n");
+ delivered = rip6stat.rip6s_ipackets -
+ rip6stat.rip6s_badsum -
+ rip6stat.rip6s_nosock -
+ rip6stat.rip6s_nosockmcast -
+ rip6stat.rip6s_fullsock;
+ if (delivered || sflag <= 1)
+ printf("\t%llu delivered\n", (unsigned long long)delivered);
+ p(rip6s_opackets, "\t%llu datagram%s output\n");
+#undef p
+}
+
+/*
* Pretty print an Internet address (net address + port).
* Take numeric_addr and numeric_port into consideration.
*/
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 81c1b3aab96..b488ab5ae1e 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.33 2001/05/28 04:22:56 assar Exp $ */
+/* $NetBSD: main.c,v 1.34 2001/10/18 09:26:16 itojun Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
-__RCSID("$NetBSD: main.c,v 1.33 2001/05/28 04:22:56 assar Exp $");
+__RCSID("$NetBSD: main.c,v 1.34 2001/10/18 09:26:16 itojun Exp $");
#endif
#endif /* not lint */
@@ -179,6 +179,8 @@ struct nlist nl[] = {
{ "_pfkeystat" },
#define N_ARPSTAT 54
{ "_arpstat" },
+#define N_RIP6STAT 55
+ { "_rip6stat" },
{ "" },
};
@@ -235,6 +237,8 @@ struct protox ip6protox[] = {
#endif
{ -1, N_PIM6STAT, 1, 0,
pim6_stats, NULL, 0, "pim6" },
+ { -1, N_RIP6STAT, 1, 0,
+ rip6_stats, NULL, 0, "rip6" },
{ -1, -1, 0, 0,
0, NULL, 0, 0 }
};
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index f253eb7a81c..ec83c6accd2 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netstat.h,v 1.22 2001/05/28 04:22:56 assar Exp $ */
+/* $NetBSD: netstat.h,v 1.23 2001/10/18 09:26:16 itojun Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -92,6 +92,7 @@ void ip6_ifstats __P((char *));
void icmp6_stats __P((u_long, char *));
void icmp6_ifstats __P((char *));
void pim6_stats __P((u_long, char *));
+void rip6_stats __P((u_long, char *));
void mroute6pr __P((u_long, u_long, u_long));
void mrt6_stats __P((u_long, u_long));
char *routename6 __P((struct sockaddr_in6 *));