1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #if HAVE_CONFIG_H |
---|
6 | #include "config.h" |
---|
7 | #endif |
---|
8 | |
---|
9 | #include <sys/param.h> |
---|
10 | #include <sys/queue.h> |
---|
11 | #include <sys/systm.h> |
---|
12 | #include <sys/kernel.h> |
---|
13 | #include <sys/sysctl.h> |
---|
14 | #include <sys/proc.h> |
---|
15 | #include <sys/mbuf.h> |
---|
16 | #include <netinet/in_systm.h> |
---|
17 | #include <netinet/in.h> |
---|
18 | #include <netinet/ip.h> |
---|
19 | #include <netinet/ip_icmp.h> |
---|
20 | #include <netinet/icmp_var.h> |
---|
21 | |
---|
22 | /* |
---|
23 | * Display ICMP statistics |
---|
24 | * Don't lock the rest of the network tasks out while printing. |
---|
25 | * It's no big deal if the values change while being printed. |
---|
26 | */ |
---|
27 | static void |
---|
28 | showicmpstat (const char *name, unsigned long n) |
---|
29 | { |
---|
30 | if (n) |
---|
31 | printf ("%35s%12lu\n", name, n); |
---|
32 | } |
---|
33 | |
---|
34 | void |
---|
35 | rtems_bsdnet_show_icmp_stats (void) |
---|
36 | { |
---|
37 | int i; |
---|
38 | char cbuf[20]; |
---|
39 | |
---|
40 | printf ("************ ICMP Statistics ************\n"); |
---|
41 | showicmpstat ("Calls to icmp_error()", icmpstat.icps_error); |
---|
42 | showicmpstat ("Errors not sent -- old was icmp", icmpstat.icps_oldicmp); |
---|
43 | for (i = 0 ; i <= ICMP_MAXTYPE ; i++) { |
---|
44 | if (icmpstat.icps_outhist[i]) { |
---|
45 | sprintf (cbuf, "Type %d sent", i); |
---|
46 | showicmpstat (cbuf, icmpstat.icps_outhist[i]); |
---|
47 | } |
---|
48 | } |
---|
49 | showicmpstat ("icmp_code out of range", icmpstat.icps_badcode); |
---|
50 | showicmpstat ("packet < ICMP_MINLEN", icmpstat.icps_tooshort); |
---|
51 | showicmpstat ("bad checksum", icmpstat.icps_checksum); |
---|
52 | showicmpstat ("calculated bound mismatch", icmpstat.icps_badlen); |
---|
53 | showicmpstat ("number of responses", icmpstat.icps_reflect); |
---|
54 | showicmpstat ("b/mcast echo requests dropped", icmpstat.icps_bmcastecho); |
---|
55 | showicmpstat ("b/mcast tstamp requests dropped", icmpstat.icps_bmcasttstamp); |
---|
56 | for (i = 0 ; i <= ICMP_MAXTYPE ; i++) { |
---|
57 | if (icmpstat.icps_inhist[i]) { |
---|
58 | sprintf (cbuf, "Type %d received", i); |
---|
59 | showicmpstat (cbuf, icmpstat.icps_inhist[i]); |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | printf ("\n"); |
---|
64 | } |
---|