[96b39164] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | */ |
---|
| 4 | |
---|
[4aa8a23] | 5 | #if HAVE_CONFIG_H |
---|
| 6 | #include "config.h" |
---|
| 7 | #endif |
---|
| 8 | |
---|
[39e6e65a] | 9 | #include <sys/param.h> |
---|
[c301570] | 10 | #include <rtems/bsd/sys/queue.h> |
---|
[39e6e65a] | 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]; |
---|
[2a94c85] | 39 | extern unsigned int icmplenPanicAvoided; |
---|
[39e6e65a] | 40 | |
---|
| 41 | printf ("************ ICMP Statistics ************\n"); |
---|
| 42 | showicmpstat ("Calls to icmp_error()", icmpstat.icps_error); |
---|
| 43 | showicmpstat ("Errors not sent -- old was icmp", icmpstat.icps_oldicmp); |
---|
| 44 | for (i = 0 ; i <= ICMP_MAXTYPE ; i++) { |
---|
| 45 | if (icmpstat.icps_outhist[i]) { |
---|
| 46 | sprintf (cbuf, "Type %d sent", i); |
---|
| 47 | showicmpstat (cbuf, icmpstat.icps_outhist[i]); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | showicmpstat ("icmp_code out of range", icmpstat.icps_badcode); |
---|
| 51 | showicmpstat ("packet < ICMP_MINLEN", icmpstat.icps_tooshort); |
---|
| 52 | showicmpstat ("bad checksum", icmpstat.icps_checksum); |
---|
| 53 | showicmpstat ("calculated bound mismatch", icmpstat.icps_badlen); |
---|
| 54 | showicmpstat ("number of responses", icmpstat.icps_reflect); |
---|
[261e743] | 55 | showicmpstat ("all echo requests dropped", icmpstat.icps_allecho); |
---|
[39e6e65a] | 56 | showicmpstat ("b/mcast echo requests dropped", icmpstat.icps_bmcastecho); |
---|
| 57 | showicmpstat ("b/mcast tstamp requests dropped", icmpstat.icps_bmcasttstamp); |
---|
| 58 | for (i = 0 ; i <= ICMP_MAXTYPE ; i++) { |
---|
| 59 | if (icmpstat.icps_inhist[i]) { |
---|
| 60 | sprintf (cbuf, "Type %d received", i); |
---|
| 61 | showicmpstat (cbuf, icmpstat.icps_inhist[i]); |
---|
| 62 | } |
---|
| 63 | } |
---|
[2a94c85] | 64 | showicmpstat ("ICMP panic avoided", icmplenPanicAvoided); |
---|
[39e6e65a] | 65 | printf ("\n"); |
---|
| 66 | } |
---|