diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 695816bf90c1..4537675eb706 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -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 @@ do { \ #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 --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 08f1f41de0cf..40a9e5d344e2 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -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 -__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 @@ icmp6_input(mp, offp, proto) 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 @@ icmp6_input(mp, offp, proto) 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 @@ icmp6_input(mp, offp, proto) 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_input(mp, offp, proto) "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 @@ icmp6_input(mp, offp, proto) #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 @@ icmp6_reflect(m, off) (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 @@ noredhdropt:; /* 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]++;