From f3b8cefe73bb296a2ad38029c345c3d0b8a81bbc Mon Sep 17 00:00:00 2001 From: itojun Date: Sun, 27 May 2001 14:04:50 +0000 Subject: [PATCH] print rip6stat --- openbsd/usr.bin/netstat/inet6.c | 37 +++++++++++++++++++++++++++++++ openbsd/usr.bin/netstat/main.c | 4 ++++ openbsd/usr.bin/netstat/netstat.h | 1 + 3 files changed, 42 insertions(+) diff --git a/openbsd/usr.bin/netstat/inet6.c b/openbsd/usr.bin/netstat/inet6.c index 67b6162067..2d9b565c14 100644 --- a/openbsd/usr.bin/netstat/inet6.c +++ b/openbsd/usr.bin/netstat/inet6.c @@ -63,6 +63,7 @@ static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94"; #include #include #include +#include #include #if 0 @@ -992,6 +993,42 @@ pim6_stats(off, name) #undef p } +/* + * 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 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/openbsd/usr.bin/netstat/main.c b/openbsd/usr.bin/netstat/main.c index 973f790d7e..00779f7366 100644 --- a/openbsd/usr.bin/netstat/main.c +++ b/openbsd/usr.bin/netstat/main.c @@ -171,6 +171,8 @@ struct nlist nl[] = { { "_mf6ctable" }, #define N_MIF6TABLE 50 { "_mif6table" }, +#define N_RIP6STATS 51 + { "_rip6stat" }, { ""}, }; @@ -216,6 +218,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/openbsd/usr.bin/netstat/netstat.h b/openbsd/usr.bin/netstat/netstat.h index b6343d3f45..84dac1112f 100644 --- a/openbsd/usr.bin/netstat/netstat.h +++ b/openbsd/usr.bin/netstat/netstat.h @@ -107,6 +107,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 *));