source: rtems/cpukit/libnetworking/rtems/rtems_showipstat.c @ 4aa8a23

4.104.114.84.95
Last change on this file since 4aa8a23 was 4aa8a23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/02/05 at 03:06:41

Include config.h.

  • Property mode set to 100644
File size: 2.3 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_var.h>
20
21/*
22 * Display IP statistics
23 * Don't lock the rest of the network tasks out while printing.
24 * It's no big deal if the values change while being printed.
25 */
26static void
27showipstat (const char *name, unsigned long n)
28{
29        if (n)
30                printf ("%35s%12lu\n", name, n);
31}
32
33void
34rtems_bsdnet_show_ip_stats (void)
35{
36        printf ("************ IP Statistics ************\n");
37        showipstat ("total packets received", ipstat.ips_total);
38        showipstat ("checksum bad", ipstat.ips_badsum);
39        showipstat ("packet too short", ipstat.ips_tooshort);
40        showipstat ("not enough data", ipstat.ips_toosmall);
41        showipstat ("ip header length < data size", ipstat.ips_badhlen);
42        showipstat ("ip length < ip header length", ipstat.ips_badlen);
43        showipstat ("fragments received", ipstat.ips_fragments);
44        showipstat ("frags dropped (dups, out of space)", ipstat.ips_fragdropped);
45        showipstat ("fragments timed out", ipstat.ips_fragtimeout);
46        showipstat ("packets forwarded", ipstat.ips_forward);
47        showipstat ("packets rcvd for unreachable dest", ipstat.ips_cantforward);
48        showipstat ("packets forwarded on same net", ipstat.ips_redirectsent);
49        showipstat ("unknown or unsupported protocol", ipstat.ips_noproto);
50        showipstat ("datagrams delivered to upper level", ipstat.ips_delivered);
51        showipstat ("total ip packets generated here", ipstat.ips_localout);
52        showipstat ("lost packets due to nobufs, etc.", ipstat.ips_odropped);
53        showipstat ("total packets reassembled ok", ipstat.ips_reassembled);
54        showipstat ("datagrams successfully fragmented", ipstat.ips_fragmented);
55        showipstat ("output fragments created", ipstat.ips_ofragments);
56        showipstat ("don't fragment flag was set, etc.", ipstat.ips_cantfrag);
57        showipstat ("error in option processing", ipstat.ips_badoptions);
58        showipstat ("packets discarded due to no route", ipstat.ips_noroute);
59        showipstat ("ip version != 4", ipstat.ips_badvers);
60        showipstat ("total raw ip packets generated", ipstat.ips_rawout);
61        showipstat ("ip length > max ip packet size", ipstat.ips_toolong);
62        printf ("\n");
63}
Note: See TracBrowser for help on using the repository browser.