Source-Changes-HG archive

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

[src/trunk]: src/sys correct timing to increment icmp6 MIB variables. sync w...



details:   https://anonhg.NetBSD.org/src/rev/1d01455cce89
branches:  trunk
changeset: 518887:1d01455cce89
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Dec 07 10:10:43 2001 +0000

description:
correct timing to increment icmp6 MIB variables.  sync with kame

diffstat:

 sys/netinet/icmp6.h  |   4 +---
 sys/netinet6/icmp6.c |  19 ++++++++++++-------
 2 files changed, 13 insertions(+), 10 deletions(-)

diffs (100 lines):

diff -r 6baafc9ce114 -r 1d01455cce89 sys/netinet/icmp6.h
--- a/sys/netinet/icmp6.h       Fri Dec 07 09:56:44 2001 +0000
+++ b/sys/netinet/icmp6.h       Fri Dec 07 10:10:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.h,v 1.19 2001/02/07 08:59:47 itojun Exp $        */
+/*     $NetBSD: icmp6.h,v 1.20 2001/12/07 10:10:43 itojun Exp $        */
 /*     $KAME: icmp6.h,v 1.39 2001/02/06 03:48:06 itojun Exp $  */
 
 /*
@@ -626,8 +626,6 @@
 #define icmp6_ifoutstat_inc(ifp, type, code) \
 do { \
                icmp6_ifstat_inc(ifp, ifs6_out_msg); \
-               if (type < ICMP6_INFOMSG_MASK) \
-                       icmp6_ifstat_inc(ifp, ifs6_out_error); \
                switch(type) { \
                 case ICMP6_DST_UNREACH: \
                         icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
diff -r 6baafc9ce114 -r 1d01455cce89 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Fri Dec 07 09:56:44 2001 +0000
+++ b/sys/netinet6/icmp6.c      Fri Dec 07 10:10:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.71 2001/11/13 00:56:58 lukem Exp $ */
+/*     $NetBSD: icmp6.c,v 1.72 2001/12/07 10:10:43 itojun Exp $        */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.71 2001/11/13 00:56:58 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.72 2001/12/07 10:10:43 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -438,6 +438,8 @@
        int icmp6len = m->m_pkthdr.len - *offp;
        int code, sum, noff;
 
+       icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg);
+
 #ifndef PULLDOWN_TEST
        IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
        /* m might change if M_LOOP.  So, call mtod after this */
@@ -451,6 +453,7 @@
        ip6 = mtod(m, struct ip6_hdr *);
        if (icmp6len < sizeof(struct icmp6_hdr)) {
                icmp6stat.icp6s_tooshort++;
+               icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
                goto freeit;
        }
 
@@ -463,6 +466,7 @@
        IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6));
        if (icmp6 == NULL) {
                icmp6stat.icp6s_tooshort++;
+               icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
                return IPPROTO_DONE;
        }
 #endif
@@ -473,6 +477,7 @@
                    "ICMP6 checksum error(%d|%x) %s\n",
                    icmp6->icmp6_type, sum, ip6_sprintf(&ip6->ip6_src)));
                icmp6stat.icp6s_checksum++;
+               icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
                goto freeit;
        }
 
@@ -495,9 +500,6 @@
 #endif
 
        icmp6stat.icp6s_inhist[icmp6->icmp6_type]++;
-       icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg);
-       if (icmp6->icmp6_type < ICMP6_INFOMSG_MASK)
-               icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
 
        switch (icmp6->icmp6_type) {
        case ICMP6_DST_UNREACH:
@@ -2204,7 +2206,8 @@
        (void)ipsec_setsocket(m, NULL);
 #endif /* IPSEC */
 
-       ip6_output(m, NULL, NULL, 0, NULL, &outif);
+       if (ip6_output(m, NULL, NULL, 0, NULL, &outif) != 0 && outif)
+               icmp6_ifstat_inc(outif, ifs6_out_error);
 
        if (outif)
                icmp6_ifoutstat_inc(outif, type, code);
@@ -2728,7 +2731,9 @@
        /* Don't lookup socket */
        (void)ipsec_setsocket(m, NULL);
 #endif /* IPSEC */
-       ip6_output(m, NULL, NULL, 0, NULL, NULL);
+       if (ip6_output(m, NULL, NULL, 0, NULL, NULL) != 0)
+               icmp6_ifstat_inc(ifp, ifs6_out_error);
+
        icmp6_ifstat_inc(ifp, ifs6_out_msg);
        icmp6_ifstat_inc(ifp, ifs6_out_redirect);
        icmp6stat.icp6s_outhist[ND_REDIRECT]++;



Home | Main Index | Thread Index | Old Index