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