Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/netstat more stats. from kame



details:   https://anonhg.NetBSD.org/src/rev/edf4ec2ffc17
branches:  trunk
changeset: 494437:edf4ec2ffc17
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Jul 06 12:40:19 2000 +0000

description:
more stats.  from kame

diffstat:

 usr.bin/netstat/if.c      |   8 ++------
 usr.bin/netstat/inet6.c   |  27 ++++++++++++++++++++++++---
 usr.bin/netstat/main.c    |   6 ++++--
 usr.bin/netstat/netstat.h |   6 +++++-
 usr.bin/netstat/route.c   |  20 ++++++++++----------
 5 files changed, 45 insertions(+), 22 deletions(-)

diffs (225 lines):

diff -r ee47430862f1 -r edf4ec2ffc17 usr.bin/netstat/if.c
--- a/usr.bin/netstat/if.c      Thu Jul 06 12:37:56 2000 +0000
+++ b/usr.bin/netstat/if.c      Thu Jul 06 12:40:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.43 2000/07/03 05:06:43 enami Exp $    */
+/*     $NetBSD: if.c,v 1.44 2000/07/06 12:40:19 itojun Exp $   */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.43 2000/07/03 05:06:43 enami Exp $");
+__RCSID("$NetBSD: if.c,v 1.44 2000/07/06 12:40:19 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,10 +72,6 @@
 static void sidewaysintpr __P((u_int, u_long));
 static void catchalarm __P((int));
 
-#ifdef INET6
-char *netname6 __P((struct sockaddr_in6 *, struct in6_addr *));
-#endif
-
 /*
  * Print a description of the network interfaces.
  * NOTE: ifnetaddr is the location of the kernel global "ifnet",
diff -r ee47430862f1 -r edf4ec2ffc17 usr.bin/netstat/inet6.c
--- a/usr.bin/netstat/inet6.c   Thu Jul 06 12:37:56 2000 +0000
+++ b/usr.bin/netstat/inet6.c   Thu Jul 06 12:40:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet6.c,v 1.9 2000/06/16 02:08:40 itojun Exp $ */
+/*     $NetBSD: inet6.c,v 1.10 2000/07/06 12:40:19 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.9 2000/06/16 02:08:40 itojun Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.10 2000/07/06 12:40:19 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -794,6 +794,9 @@
                        PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i);
                }
        }
+
+       p1(ip6s_forward_cachehit, "\t%llu forward cache hit\n");
+       p1(ip6s_forward_cachemiss, "\t%llu forward cache miss\n");
 #undef p
 #undef p1
 }
@@ -811,7 +814,7 @@
     printf(m, (unsigned long long)ifr.ifr_ifru.ifru_stat.f, \
        plural(ifr.ifr_ifru.ifru_stat.f))
 #define        p_5(f, m) if (ifr.ifr_ifru.ifru_stat.f || sflag <= 1) \
-    printf(m, ip6stat.f)
+    printf(m, (unsigned long long)ip6stat.f)
 
        if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
                perror("Warning: socket(AF_INET6)");
@@ -1133,6 +1136,8 @@
 
 #define        p(f, m) if (icmp6stat.f || sflag <= 1) \
     printf(m, (unsigned long long)icmp6stat.f, plural(icmp6stat.f))
+#define p_5(f, m) if (icmp6stat.f || sflag <= 1) \
+    printf(m, (unsigned long long)icmp6stat.f)
 
        p(icp6s_error, "\t%llu call%s to icmp6_error\n");
        p(icp6s_canterror,
@@ -1161,9 +1166,25 @@
                        printf("\t\t%s: %llu\n", icmp6names[i],
                                (unsigned long long)icmp6stat.icp6s_inhist[i]);
                }
+       printf("\tHistogram of error messages to be generated:\n");
+       p_5(icp6s_odst_unreach_noroute, "\t\t%llu no route\n");
+       p_5(icp6s_odst_unreach_admin, "\t\t%llu administratively prohibited\n");
+       p_5(icp6s_odst_unreach_beyondscope, "\t\t%llu beyond scope\n");
+       p_5(icp6s_odst_unreach_addr, "\t\t%llu address unreachable\n");
+       p_5(icp6s_odst_unreach_noport, "\t\t%llu port unreachable\n");
+       p_5(icp6s_opacket_too_big, "\t\t%llu packet too big\n");
+       p_5(icp6s_otime_exceed_transit, "\t\t%llu time exceed transit\n");
+       p_5(icp6s_otime_exceed_reassembly, "\t\t%llu time exceed reassembly\n");
+       p_5(icp6s_oparamprob_header, "\t\t%llu erroneous header field\n");
+       p_5(icp6s_oparamprob_nextheader, "\t\t%llu unrecognized next header\n");
+       p_5(icp6s_oparamprob_option, "\t\t%llu unrecognized option\n");
+       p_5(icp6s_oredirect, "\t\t%llu redirect\n");
+       p_5(icp6s_ounknown, "\t\t%llu unknown\n");
+
        p(icp6s_reflect, "\t%llu message response%s generated\n");
        p(icp6s_nd_toomanyopt, "\t%llu message%s with too many ND options\n");
 #undef p
+#undef p_5
 }
 
 /*
diff -r ee47430862f1 -r edf4ec2ffc17 usr.bin/netstat/main.c
--- a/usr.bin/netstat/main.c    Thu Jul 06 12:37:56 2000 +0000
+++ b/usr.bin/netstat/main.c    Thu Jul 06 12:40:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.27 2000/04/14 06:11:09 simonb Exp $ */
+/*     $NetBSD: main.c,v 1.28 2000/07/06 12:40:19 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.27 2000/04/14 06:11:09 simonb Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2000/07/06 12:40:19 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -339,6 +339,8 @@
                                af = AF_INET;
                        else if (strcmp(optarg, "inet6") == 0)
                                af = AF_INET6;
+                       else if (strcmp(optarg, "pfkey") == 0)
+                               af = PF_KEY;
                        else if (strcmp(optarg, "unix") == 0
                            || strcmp(optarg, "local") == 0)
                                af = AF_LOCAL;
diff -r ee47430862f1 -r edf4ec2ffc17 usr.bin/netstat/netstat.h
--- a/usr.bin/netstat/netstat.h Thu Jul 06 12:37:56 2000 +0000
+++ b/usr.bin/netstat/netstat.h Thu Jul 06 12:40:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netstat.h,v 1.18 2000/02/26 09:55:24 itojun Exp $      */
+/*     $NetBSD: netstat.h,v 1.19 2000/07/06 12:40:19 itojun Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -82,6 +82,7 @@
 
 #ifdef INET6
 struct sockaddr_in6;
+struct in6_addr;
 void   ip6protopr __P((u_long, char *));
 void   tcp6_stats __P((u_long, char *));
 void   tcp6_dump __P((u_long));
@@ -113,6 +114,9 @@
 
 char   *routename __P((u_int32_t));
 char   *netname __P((u_int32_t, u_int32_t));
+#ifdef INET6
+char   *netname6 __P((struct sockaddr_in6 *, struct in6_addr *));
+#endif 
 char   *atalk_print __P((const struct sockaddr *, int));
 char   *atalk_print2 __P((const struct sockaddr *, const struct sockaddr *,
     int));
diff -r ee47430862f1 -r edf4ec2ffc17 usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c   Thu Jul 06 12:37:56 2000 +0000
+++ b/usr.bin/netstat/route.c   Thu Jul 06 12:40:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.48 2000/01/17 18:03:51 itojun Exp $        */
+/*     $NetBSD: route.c,v 1.49 2000/07/06 12:40:19 itojun Exp $        */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from: @(#)route.c      8.3 (Berkeley) 3/9/94";
 #else
-__RCSID("$NetBSD: route.c,v 1.48 2000/01/17 18:03:51 itojun Exp $");
+__RCSID("$NetBSD: route.c,v 1.49 2000/07/06 12:40:19 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -140,9 +140,6 @@
 static void ntreestuff __P((void));
 static u_long forgemask __P((u_long));
 static void domask __P((char *, size_t, u_long, u_long));
-#ifdef INET6
-char *netname6 __P((struct sockaddr_in6 *, struct in6_addr *));
-#endif 
 
 /*
  * Print routing tables.
@@ -230,9 +227,15 @@
 #define        WID_GW(af)      18      /* width of gateway column */
 #else
 /* width of destination/gateway column */
+#ifdef KAME_SCOPEID
+/* strlen("fe80::aaaa:bbbb:cccc:dddd@gif0") == 30, strlen("/128") == 4 */
+#define        WID_DST(af)     ((af) == AF_INET6 ? (nflag ? 34 : 18) : 18)
+#define        WID_GW(af)      ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18)
+#else
 /* strlen("fe80::aaaa:bbbb:cccc:dddd") == 25, strlen("/128") == 4 */
 #define        WID_DST(af)     ((af) == AF_INET6 ? (nflag ? 29 : 18) : 18)
 #define        WID_GW(af)      ((af) == AF_INET6 ? (nflag ? 25 : 18) : 18)
+#endif
 #endif /* INET6 */
 
 /*
@@ -818,7 +821,7 @@
        sin6 = *sa6;
        if (mask) {
                masklen = 0;
-               lim = (u_char *)mask + 16;
+               lim = (u_char *)(mask + 1);
                for (p = (u_char *)mask, q = (u_char *)&sin6.sin6_addr;
                     p < lim;
                     p++, q++) {
@@ -874,15 +877,12 @@
                        else
                                *q = 0;
                }
-       }
-       else
+       } else
                masklen = 128;
 
        if (masklen == 0 && IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
                return("default");
 
-       if (illegal)
-               fprintf(stderr, "illegal prefixlen\n");
        if (nflag)
                flag |= NI_NUMERICHOST;
        error = getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,



Home | Main Index | Thread Index | Old Index