Skip to content

Commit

Permalink
print rip6stat
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed May 27, 2001
1 parent 219e67a commit f3b8cef
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
37 changes: 37 additions & 0 deletions openbsd/usr.bin/netstat/inet6.c
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions openbsd/usr.bin/netstat/main.c
Expand Up @@ -171,6 +171,8 @@ struct nlist nl[] = {
{ "_mf6ctable" },
#define N_MIF6TABLE 50
{ "_mif6table" },
#define N_RIP6STATS 51
{ "_rip6stat" },
{ ""},
};

Expand Down Expand Up @@ -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 }
};
Expand Down
1 change: 1 addition & 0 deletions openbsd/usr.bin/netstat/netstat.h
Expand Up @@ -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 *));
Expand Down

0 comments on commit f3b8cef

Please sign in to comment.