diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-04-12 13:22:33 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-04-12 13:22:33 +0000 |
commit | 4801e9aee9baec5543d3d78abf1d7432044173fe (patch) | |
tree | 8468527867e08bef8398c91c078aae786df7c3f8 /sys/netinet6 | |
parent | 6958bbf168b98d4b8a70ef9cf01445b28ff778b0 (diff) | |
download | FreeBSD-src-4801e9aee9baec5543d3d78abf1d7432044173fe.zip FreeBSD-src-4801e9aee9baec5543d3d78abf1d7432044173fe.tar.gz |
Update stats in struct icmpstat and icmp6stat using four new
macros: ICMPSTAT_ADD(), ICMPSTAT_INC(), ICMP6STAT_ADD(), and
ICMP6STAT_INC(), rather than directly manipulating the fields
of these structures across the kernel. This will make it
easier to change the implementation of these statistics,
such as using per-CPU versions of the data structures.
In on case, icmp6stat members are manipulated indirectly, by
icmp6_errcount(), and this will require further work to fix
for per-CPU stats.
MFC after: 3 days
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/icmp6.c | 54 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 12 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 8 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 2 |
6 files changed, 42 insertions, 42 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 27159db..277e313 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -254,14 +254,14 @@ icmp6_error(struct mbuf *m, int type, int code, int param) int off; int nxt; - V_icmp6stat.icp6s_error++; + ICMP6STAT_INC(icp6s_error); /* count per-type-code statistics */ icmp6_errcount(&V_icmp6stat.icp6s_outerrhist, type, code); #ifdef M_DECRYPTED /*not openbsd*/ if (m->m_flags & M_DECRYPTED) { - V_icmp6stat.icp6s_canterror++; + ICMP6STAT_INC(icp6s_canterror); goto freeit; } #endif @@ -319,7 +319,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) IP6_EXTHDR_GET(icp, struct icmp6_hdr *, m, off, sizeof(*icp)); if (icp == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -330,7 +330,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) * Special case: for redirect (which is * informational) we must not send icmp6 error. */ - V_icmp6stat.icp6s_canterror++; + ICMP6STAT_INC(icp6s_canterror); goto freeit; } else { /* ICMPv6 informational - send the error */ @@ -343,7 +343,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) /* Finally, do rate limitation check. */ if (icmp6_ratelimit(&oip6->ip6_src, type, code)) { - V_icmp6stat.icp6s_toofreq++; + ICMP6STAT_INC(icp6s_toofreq); goto freeit; } @@ -384,7 +384,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) */ m->m_pkthdr.rcvif = NULL; - V_icmp6stat.icp6s_outhist[type]++; + ICMP6STAT_INC(icp6s_outhist[type]); icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ return; @@ -424,7 +424,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) ip6 = mtod(m, struct ip6_hdr *); if (icmp6len < sizeof(struct icmp6_hdr)) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); goto freeit; } @@ -436,7 +436,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) #else IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6)); if (icmp6 == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return IPPROTO_DONE; } #endif @@ -447,7 +447,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) "ICMP6 checksum error(%d|%x) %s\n", icmp6->icmp6_type, sum, ip6_sprintf(ip6bufs, &ip6->ip6_src))); - V_icmp6stat.icp6s_checksum++; + ICMP6STAT_INC(icp6s_checksum); goto freeit; } @@ -467,7 +467,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } } - V_icmp6stat.icp6s_inhist[icmp6->icmp6_type]++; + ICMP6STAT_INC(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); @@ -601,8 +601,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) nicmp6->icmp6_type = ICMP6_ECHO_REPLY; nicmp6->icmp6_code = 0; if (n) { - V_icmp6stat.icp6s_reflect++; - V_icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY]++; + ICMP6STAT_INC(icp6s_reflect); + ICMP6STAT_INC(icp6s_outhist[ICMP6_ECHO_REPLY]); icmp6_reflect(n, noff); } break; @@ -734,8 +734,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } #undef hostnamelen if (n) { - V_icmp6stat.icp6s_reflect++; - V_icmp6stat.icp6s_outhist[ICMP6_WRUREPLY]++; + ICMP6STAT_INC(icp6s_reflect); + ICMP6STAT_INC(icp6s_outhist[ICMP6_WRUREPLY]); icmp6_reflect(n, noff); } break; @@ -856,11 +856,11 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; badcode: - V_icmp6stat.icp6s_badcode++; + ICMP6STAT_INC(icp6s_badcode); break; badlen: - V_icmp6stat.icp6s_badlen++; + ICMP6STAT_INC(icp6s_badlen); break; } @@ -885,7 +885,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) struct sockaddr_in6 icmp6src, icmp6dst; if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); goto freeit; } #ifndef PULLDOWN_TEST @@ -896,7 +896,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6) + sizeof(struct ip6_hdr)); if (icmp6 == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -931,7 +931,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(eh, struct ip6_ext *, m, eoff, sizeof(*eh)); if (eh == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -959,7 +959,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m, eoff, sizeof(*rth)); if (rth == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -985,7 +985,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) struct ip6_rthdr0 *, m, eoff, rthlen); if (rth0 == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -1007,7 +1007,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(fh, struct ip6_frag *, m, eoff, sizeof(*fh)); if (fh == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -1042,7 +1042,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6) + sizeof(struct ip6_hdr)); if (icmp6 == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return (-1); } #endif @@ -1156,7 +1156,7 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) if (mtu < tcp_maxmtu6(&inc, NULL)) { tcp_hc_updatemtu(&inc, mtu); - V_icmp6stat.icp6s_pmtuchg++; + ICMP6STAT_INC(icp6s_pmtuchg); } } @@ -2276,7 +2276,7 @@ icmp6_redirect_input(struct mbuf *m, int off) #else IP6_EXTHDR_GET(nd_rd, struct nd_redirect *, m, off, icmp6len); if (nd_rd == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -2439,7 +2439,7 @@ icmp6_redirect_input(struct mbuf *m, int off) return; bad: - V_icmp6stat.icp6s_badredirect++; + ICMP6STAT_INC(icp6s_badredirect); m_freem(m); } @@ -2715,7 +2715,7 @@ noredhdropt:; icmp6_ifstat_inc(outif, ifs6_out_msg); icmp6_ifstat_inc(outif, ifs6_out_redirect); } - V_icmp6stat.icp6s_outhist[ND_REDIRECT]++; + ICMP6STAT_INC(icp6s_outhist[ND_REDIRECT]); return; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index a672a04..29b71be 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -288,7 +288,7 @@ mld6_input(struct mbuf *m, int off) #else IP6_EXTHDR_GET(mldh, struct mld_hdr *, m, off, sizeof(*mldh)); if (mldh == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -517,7 +517,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) im6o.im6o_multicast_loop = (ip6_mrouter != NULL); /* increment output statictics */ - V_icmp6stat.icp6s_outhist[type]++; + ICMP6STAT_INC(icp6s_outhist[type]); ip6_output(mh, &V_ip6_opts, NULL, 0, &im6o, &outif, NULL); if (outif) { diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 535f329..857d3fc 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -374,7 +374,7 @@ nd6_options(union nd_opts *ndopts) * Message validation requires that all included * options have a length that is greater than zero. */ - V_icmp6stat.icp6s_nd_badopt++; + ICMP6STAT_INC(icp6s_nd_badopt); bzero(ndopts, sizeof(*ndopts)); return -1; } @@ -418,7 +418,7 @@ nd6_options(union nd_opts *ndopts) skip1: i++; if (i > V_nd6_maxndopt) { - V_icmp6stat.icp6s_nd_toomanyopt++; + ICMP6STAT_INC(icp6s_nd_toomanyopt); nd6log((LOG_INFO, "too many loop in nd opt\n")); break; } diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 1f88fb1..c83a245 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -128,7 +128,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_ns, struct nd_neighbor_solicit *, m, off, icmp6len); if (nd_ns == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -365,7 +365,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) ip6_sprintf(ip6bufs, &daddr6))); nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(ip6bufs, &taddr6))); - V_icmp6stat.icp6s_badns++; + ICMP6STAT_INC(icp6s_badns); m_freem(m); } @@ -563,7 +563,7 @@ nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); - V_icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; + ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_SOLICIT]); if (ro.ro_rt) { /* we don't cache this route. */ RTFREE(ro.ro_rt); @@ -625,7 +625,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_na, struct nd_neighbor_advert *, m, off, icmp6len); if (nd_na == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -897,7 +897,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (ln != NULL) LLE_WUNLOCK(ln); - V_icmp6stat.icp6s_badna++; + ICMP6STAT_INC(icp6s_badna); m_freem(m); } @@ -1065,7 +1065,7 @@ nd6_na_output(struct ifnet *ifp, const struct in6_addr *daddr6_0, ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); - V_icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; + ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_ADVERT]); if (ro.ro_rt) { /* we don't cache this route. */ RTFREE(ro.ro_rt); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index e71f025..1b59db7 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -155,7 +155,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len); if (nd_rs == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -190,7 +190,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) return; bad: - V_icmp6stat.icp6s_badrs++; + ICMP6STAT_INC(icp6s_badrs); m_freem(m); } @@ -246,7 +246,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) #else IP6_EXTHDR_GET(nd_ra, struct nd_router_advert *, m, off, icmp6len); if (nd_ra == NULL) { - V_icmp6stat.icp6s_tooshort++; + ICMP6STAT_INC(icp6s_tooshort); return; } #endif @@ -422,7 +422,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) return; bad: - V_icmp6stat.icp6s_badra++; + ICMP6STAT_INC(icp6s_badra); m_freem(m); } diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index bce1b14..2ac95e5 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -477,7 +477,7 @@ rip6_output(m, va_alist) if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { if (oifp) icmp6_ifoutstat_inc(oifp, type, code); - V_icmp6stat.icp6s_outhist[type]++; + ICMP6STAT_INC(icp6s_outhist[type]); } else V_rip6stat.rip6s_opackets++; |