source: rtems/cpukit/libnetworking/rtems/rtems_showicmpstat.c @ c301570

4.104.114.84.9
Last change on this file since c301570 was c301570, checked in by Ralf Corsepius <ralf.corsepius@…>, on May 10, 2007 at 5:12:54 AM

Include <rtems/bsd/sys/queue.h> instead of <sys/queue.h>.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  $Id$
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <sys/param.h>
10#include <rtems/bsd/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 */
27static void
28showicmpstat (const char *name, unsigned long n)
29{
30        if (n)
31                printf ("%35s%12lu\n", name, n);
32}
33
34void
35rtems_bsdnet_show_icmp_stats (void)
36{
37        int i;
38        char cbuf[20];
39        extern unsigned int icmplenPanicAvoided;
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);
55        showicmpstat ("all echo requests dropped", icmpstat.icps_allecho);
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        }
64        showicmpstat ("ICMP panic avoided", icmplenPanicAvoided);
65        printf ("\n");
66}
Note: See TracBrowser for help on using the repository browser.