Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/netstat print rip6stat. sync with kame



details:   https://anonhg.NetBSD.org/src/rev/589a8b2e4b53
branches:  trunk
changeset: 516192:589a8b2e4b53
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Oct 18 09:26:16 2001 +0000

description:
print rip6stat.  sync with kame

diffstat:

 usr.bin/netstat/inet6.c   |  42 ++++++++++++++++++++++++++++++++++++++++--
 usr.bin/netstat/main.c    |   8 ++++++--
 usr.bin/netstat/netstat.h |   3 ++-
 3 files changed, 48 insertions(+), 5 deletions(-)

diffs (123 lines):

diff -r a05858f5c6ff -r 589a8b2e4b53 usr.bin/netstat/inet6.c
--- a/usr.bin/netstat/inet6.c   Thu Oct 18 09:26:08 2001 +0000
+++ b/usr.bin/netstat/inet6.c   Thu Oct 18 09:26:16 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet6.c,v 1.22 2001/09/10 14:25:12 thorpej Exp $       */
+/*     $NetBSD: inet6.c,v 1.23 2001/10/18 09:26:16 itojun Exp $        */
 /*     BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp   */
 
 /*
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = "@(#)inet.c     8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet6.c,v 1.22 2001/09/10 14:25:12 thorpej Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.23 2001/10/18 09:26:16 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,6 +117,7 @@
 #include <netinet6/udp6.h>
 #include <netinet6/udp6_var.h>
 #include <netinet6/pim6_var.h>
+#include <netinet6/raw_ip6.h>
 
 #include <arpa/inet.h>
 #if 0
@@ -1101,6 +1102,43 @@
 }
 
 /*
+ * Dump raw ip6 statistics structure.
+ */
+void
+rip6_stats(off, name)
+       u_long off;
+       char *name;
+{
+       struct rip6stat rip6stat;
+       u_quad_t delivered;
+
+       if (off == 0)
+               return;
+       kread(off, (char *)&rip6stat, sizeof(rip6stat));
+       printf("%s:\n", name);
+
+#define        p(f, m) if (rip6stat.f || sflag <= 1) \
+    printf(m, (unsigned long long)rip6stat.f, plural(rip6stat.f))
+       p(rip6s_ipackets, "\t%llu message%s received\n");
+       p(rip6s_isum, "\t%llu checksum calcuration%s on inbound\n");
+       p(rip6s_badsum, "\t%llu message%s with bad checksum\n");
+       p(rip6s_nosock, "\t%llu message%s dropped due to no socket\n");
+       p(rip6s_nosockmcast,
+           "\t%llu multicast message%s dropped due to no socket\n");
+       p(rip6s_fullsock,
+           "\t%llu message%s dropped due to full socket buffers\n");
+       delivered = rip6stat.rip6s_ipackets -
+                   rip6stat.rip6s_badsum -
+                   rip6stat.rip6s_nosock -
+                   rip6stat.rip6s_nosockmcast -
+                   rip6stat.rip6s_fullsock;
+       if (delivered || sflag <= 1)
+               printf("\t%llu delivered\n", (unsigned long long)delivered);
+       p(rip6s_opackets, "\t%llu datagram%s output\n");
+#undef p
+}
+
+/*
  * Pretty print an Internet address (net address + port).
  * Take numeric_addr and numeric_port into consideration.
  */
diff -r a05858f5c6ff -r 589a8b2e4b53 usr.bin/netstat/main.c
--- a/usr.bin/netstat/main.c    Thu Oct 18 09:26:08 2001 +0000
+++ b/usr.bin/netstat/main.c    Thu Oct 18 09:26:16 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.33 2001/05/28 04:22:56 assar Exp $  */
+/*     $NetBSD: main.c,v 1.34 2001/10/18 09:26:16 itojun Exp $ */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "from: @(#)main.c       8.4 (Berkeley) 3/1/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.33 2001/05/28 04:22:56 assar Exp $");
+__RCSID("$NetBSD: main.c,v 1.34 2001/10/18 09:26:16 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -179,6 +179,8 @@
        { "_pfkeystat" },
 #define N_ARPSTAT      54
        { "_arpstat" },
+#define N_RIP6STAT     55
+       { "_rip6stat" },
        { "" },
 };
 
@@ -235,6 +237,8 @@
 #endif
        { -1,           N_PIM6STAT,     1,      0,
          pim6_stats,   NULL,           0,      "pim6" },
+       { -1,           N_RIP6STAT,     1,      0,
+         rip6_stats,   NULL,           0,      "rip6" },
        { -1,           -1,             0,      0,
          0,            NULL,           0,      0 }
 };
diff -r a05858f5c6ff -r 589a8b2e4b53 usr.bin/netstat/netstat.h
--- a/usr.bin/netstat/netstat.h Thu Oct 18 09:26:08 2001 +0000
+++ b/usr.bin/netstat/netstat.h Thu Oct 18 09:26:16 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netstat.h,v 1.22 2001/05/28 04:22:56 assar Exp $       */
+/*     $NetBSD: netstat.h,v 1.23 2001/10/18 09:26:16 itojun Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -92,6 +92,7 @@
 void   icmp6_stats __P((u_long, char *));
 void   icmp6_ifstats __P((char *));
 void   pim6_stats __P((u_long, char *));
+void   rip6_stats __P((u_long, char *));
 void   mroute6pr __P((u_long, u_long, u_long));
 void   mrt6_stats __P((u_long, u_long));
 char   *routename6 __P((struct sockaddr_in6 *));



Home | Main Index | Thread Index | Old Index