diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-07 21:58:39 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-07 21:58:39 +0000 |
commit | ef1143a8d0351470191130ac7a935e01bdbc6035 (patch) | |
tree | 385173e2c22cce534ca1f860ba2c0b9486db5da2 /usr.bin | |
parent | fef235fa16b9c828f0e9f82086bf99ac3181b384 (diff) |
print rip6stat
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/netstat/inet6.c | 42 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 8 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 3 |
3 files changed, 48 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index 08c62b30e34..2627fcf1ac6 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet6.c,v 1.20 2002/05/27 01:50:36 deraadt Exp $ */ +/* $OpenBSD: inet6.c,v 1.21 2002/06/07 21:58:38 itojun Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* * Copyright (c) 1983, 1988, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -/*__RCSID("$OpenBSD: inet6.c,v 1.20 2002/05/27 01:50:36 deraadt Exp $");*/ +/*__RCSID("$OpenBSD: inet6.c,v 1.21 2002/06/07 21:58:38 itojun Exp $");*/ /*__RCSID("KAME Id: inet6.c,v 1.10 2000/02/09 10:49:31 itojun Exp");*/ #endif #endif /* not lint */ @@ -63,6 +63,7 @@ static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94"; #include <netinet6/ip6_var.h> #include <netinet6/in6_var.h> #include <netinet6/pim6_var.h> +#include <netinet6/raw_ip6.h> #include <arpa/inet.h> #if 0 @@ -996,6 +997,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). * If the nflag was specified, use numbers instead of names. */ diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index e4e7d154426..7d3aaea5240 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.31 2002/05/27 01:50:36 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.32 2002/06/07 21:58:38 itojun 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.31 2002/05/27 01:50:36 deraadt Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.32 2002/06/07 21:58:38 itojun Exp $"; #endif #endif /* not lint */ @@ -177,6 +177,8 @@ struct nlist nl[] = { { "_mclpool" }, #define N_IPCOMPSTAT 53 { "_ipcompstat" }, +#define N_RIP6STAT 54 + { "_rip6stat" }, { ""}, }; @@ -224,6 +226,8 @@ struct protox ip6protox[] = { icmp6_stats, "icmp6" }, { -1, N_PIM6STAT, 1, 0, pim6_stats, "pim6" }, + { -1, N_RIP6STAT, 1, 0, + rip6_stats, "rip6" }, { -1, -1, 0, 0, 0, 0 } }; diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 3845bf90f55..eb72e2932d8 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.21 2002/02/17 19:42:31 millert Exp $ */ +/* $OpenBSD: netstat.h,v 1.22 2002/06/07 21:58:38 itojun Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -110,6 +110,7 @@ void ip6_ifstats(char *); void icmp6_stats(u_long, char *); void icmp6_ifstats(char *); void pim6_stats(u_long, char *); +void rip6_stats(u_long, char *); void mroute6pr(u_long, u_long, u_long); void mrt6_stats(u_long, u_long); char *routename6(struct sockaddr_in6 *); |