1 |
30 |
unneback |
/*
|
2 |
|
|
* $Id: rtems_showipstat.c,v 1.2 2001-09-27 12:02:00 chris Exp $
|
3 |
|
|
*/
|
4 |
|
|
|
5 |
|
|
#include <sys/param.h>
|
6 |
|
|
#include <sys/queue.h>
|
7 |
|
|
#include <sys/systm.h>
|
8 |
|
|
#include <sys/kernel.h>
|
9 |
|
|
#include <sys/sysctl.h>
|
10 |
|
|
#include <sys/proc.h>
|
11 |
|
|
#include <sys/mbuf.h>
|
12 |
|
|
#include <netinet/in_systm.h>
|
13 |
|
|
#include <netinet/in.h>
|
14 |
|
|
#include <netinet/ip.h>
|
15 |
|
|
#include <netinet/ip_var.h>
|
16 |
|
|
|
17 |
|
|
/*
|
18 |
|
|
* Display IP statistics
|
19 |
|
|
* Don't lock the rest of the network tasks out while printing.
|
20 |
|
|
* It's no big deal if the values change while being printed.
|
21 |
|
|
*/
|
22 |
|
|
static void
|
23 |
|
|
showipstat (const char *name, unsigned long n)
|
24 |
|
|
{
|
25 |
|
|
if (n)
|
26 |
|
|
printf ("%35s%12lu\n", name, n);
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
void
|
30 |
|
|
rtems_bsdnet_show_ip_stats (void)
|
31 |
|
|
{
|
32 |
|
|
printf ("************ IP Statistics ************\n");
|
33 |
|
|
showipstat ("total packets received", ipstat.ips_total);
|
34 |
|
|
showipstat ("checksum bad", ipstat.ips_badsum);
|
35 |
|
|
showipstat ("packet too short", ipstat.ips_tooshort);
|
36 |
|
|
showipstat ("not enough data", ipstat.ips_toosmall);
|
37 |
|
|
showipstat ("ip header length < data size", ipstat.ips_badhlen);
|
38 |
|
|
showipstat ("ip length < ip header length", ipstat.ips_badlen);
|
39 |
|
|
showipstat ("fragments received", ipstat.ips_fragments);
|
40 |
|
|
showipstat ("frags dropped (dups, out of space)", ipstat.ips_fragdropped);
|
41 |
|
|
showipstat ("fragments timed out", ipstat.ips_fragtimeout);
|
42 |
|
|
showipstat ("packets forwarded", ipstat.ips_forward);
|
43 |
|
|
showipstat ("packets rcvd for unreachable dest", ipstat.ips_cantforward);
|
44 |
|
|
showipstat ("packets forwarded on same net", ipstat.ips_redirectsent);
|
45 |
|
|
showipstat ("unknown or unsupported protocol", ipstat.ips_noproto);
|
46 |
|
|
showipstat ("datagrams delivered to upper level", ipstat.ips_delivered);
|
47 |
|
|
showipstat ("total ip packets generated here", ipstat.ips_localout);
|
48 |
|
|
showipstat ("lost packets due to nobufs, etc.", ipstat.ips_odropped);
|
49 |
|
|
showipstat ("total packets reassembled ok", ipstat.ips_reassembled);
|
50 |
|
|
showipstat ("datagrams successfully fragmented", ipstat.ips_fragmented);
|
51 |
|
|
showipstat ("output fragments created", ipstat.ips_ofragments);
|
52 |
|
|
showipstat ("don't fragment flag was set, etc.", ipstat.ips_cantfrag);
|
53 |
|
|
showipstat ("error in option processing", ipstat.ips_badoptions);
|
54 |
|
|
showipstat ("packets discarded due to no route", ipstat.ips_noroute);
|
55 |
|
|
showipstat ("ip version != 4", ipstat.ips_badvers);
|
56 |
|
|
showipstat ("total raw ip packets generated", ipstat.ips_rawout);
|
57 |
|
|
showipstat ("ip length > max ip packet size", ipstat.ips_toolong);
|
58 |
|
|
printf ("\n");
|
59 |
|
|
}
|