source: rtems/cpukit/libnetworking/rtems/rtems_showicmpstat.c @ 2a94c85

4.104.114.84.95
Last change on this file since 2a94c85 was 2a94c85, checked in by Eric Norum <WENorum@…>, on 05/24/05 at 00:36:35

Add "ICMP panic avoided" diagnostic counter.

  • Property mode set to 100644
File size: 1.8 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 <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 ("b/mcast echo requests dropped", icmpstat.icps_bmcastecho);
56        showicmpstat ("b/mcast tstamp requests dropped", icmpstat.icps_bmcasttstamp);
57        for (i = 0 ; i <= ICMP_MAXTYPE ; i++) {
58                if (icmpstat.icps_inhist[i]) {
59                        sprintf (cbuf, "Type %d received", i);
60                        showicmpstat (cbuf, icmpstat.icps_inhist[i]);
61                }
62        }
63        showicmpstat ("ICMP panic avoided", icmplenPanicAvoided);
64        printf ("\n");
65}
Note: See TracBrowser for help on using the repository browser.