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