Use IP6STAT_INC/IP6STAT_DEC macros to update ip6 stats.

MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2013-04-09 07:11:22 +00:00
parent edd6bc7670
commit 9cb8d207af
15 changed files with 102 additions and 101 deletions

View File

@ -3336,14 +3336,14 @@ bridge_ip6_checkbasic(struct mbuf **mp)
if ((m = m_copyup(m, sizeof(struct ip6_hdr), if ((m = m_copyup(m, sizeof(struct ip6_hdr),
(max_linkhdr + 3) & ~3)) == NULL) { (max_linkhdr + 3) & ~3)) == NULL) {
/* XXXJRT new stat, please */ /* XXXJRT new stat, please */
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
in6_ifstat_inc(inifp, ifs6_in_hdrerr); in6_ifstat_inc(inifp, ifs6_in_hdrerr);
goto bad; goto bad;
} }
} else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) { } else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) {
struct ifnet *inifp = m->m_pkthdr.rcvif; struct ifnet *inifp = m->m_pkthdr.rcvif;
if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
in6_ifstat_inc(inifp, ifs6_in_hdrerr); in6_ifstat_inc(inifp, ifs6_in_hdrerr);
goto bad; goto bad;
} }
@ -3352,7 +3352,7 @@ bridge_ip6_checkbasic(struct mbuf **mp)
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
V_ip6stat.ip6s_badvers++; IP6STAT_INC(ip6s_badvers);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr);
goto bad; goto bad;
} }

View File

@ -275,24 +275,24 @@ do { \
if (((m)->m_flags & M_LOOP) && \ if (((m)->m_flags & M_LOOP) && \
((m)->m_len < (off) + (hlen)) && \ ((m)->m_len < (off) + (hlen)) && \
(((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
V_ip6stat.ip6s_exthdrtoolong++; \ IP6STAT_INC(ip6s_exthdrtoolong); \
return ret; \ return ret; \
} else if ((m)->m_flags & M_EXT) { \ } else if ((m)->m_flags & M_EXT) { \
if ((m)->m_len < (off) + (hlen)) { \ if ((m)->m_len < (off) + (hlen)) { \
V_ip6stat.ip6s_exthdrtoolong++; \ IP6STAT_INC(ip6s_exthdrtoolong); \
m_freem(m); \ m_freem(m); \
return ret; \ return ret; \
} \ } \
} else { \ } else { \
if ((m)->m_len < (off) + (hlen)) { \ if ((m)->m_len < (off) + (hlen)) { \
V_ip6stat.ip6s_exthdrtoolong++; \ IP6STAT_INC(ip6s_exthdrtoolong); \
m_freem(m); \ m_freem(m); \
return ret; \ return ret; \
} \ } \
} \ } \
} else { \ } else { \
if ((m)->m_len < (off) + (hlen)) { \ if ((m)->m_len < (off) + (hlen)) { \
V_ip6stat.ip6s_tooshort++; \ IP6STAT_INC(ip6s_tooshort); \
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
m_freem(m); \ m_freem(m); \
return ret; \ return ret; \

View File

@ -93,7 +93,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto)
for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
if (*opt != IP6OPT_PAD1 && if (*opt != IP6OPT_PAD1 &&
(dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
goto bad; goto bad;
} }

View File

@ -215,7 +215,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
return IPPROTO_DONE; return IPPROTO_DONE;
} }
V_ip6stat.ip6s_fragments++; IP6STAT_INC(ip6s_fragments);
in6_ifstat_inc(dstifp, ifs6_reass_reqd); in6_ifstat_inc(dstifp, ifs6_reass_reqd);
/* offset now points to data portion */ /* offset now points to data portion */
@ -228,7 +228,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
*/ */
if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) {
/* XXX-BZ we want dedicated counters for this. */ /* XXX-BZ we want dedicated counters for this. */
V_ip6stat.ip6s_reassembled++; IP6STAT_INC(ip6s_reassembled);
in6_ifstat_inc(dstifp, ifs6_reass_ok); in6_ifstat_inc(dstifp, ifs6_reass_ok);
*offp = offset; *offp = offset;
return (ip6f->ip6f_nxt); return (ip6f->ip6f_nxt);
@ -603,7 +603,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
m->m_pkthdr.len = plen; m->m_pkthdr.len = plen;
} }
V_ip6stat.ip6s_reassembled++; IP6STAT_INC(ip6s_reassembled);
in6_ifstat_inc(dstifp, ifs6_reass_ok); in6_ifstat_inc(dstifp, ifs6_reass_ok);
/* /*
@ -619,7 +619,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
dropfrag: dropfrag:
IP6Q_UNLOCK(); IP6Q_UNLOCK();
in6_ifstat_inc(dstifp, ifs6_reass_fail); in6_ifstat_inc(dstifp, ifs6_reass_fail);
V_ip6stat.ip6s_fragdropped++; IP6STAT_INC(ip6s_fragdropped);
m_freem(m); m_freem(m);
return IPPROTO_DONE; return IPPROTO_DONE;
} }
@ -743,7 +743,7 @@ frag6_slowtimo(void)
--q6->ip6q_ttl; --q6->ip6q_ttl;
q6 = q6->ip6q_next; q6 = q6->ip6q_next;
if (q6->ip6q_prev->ip6q_ttl == 0) { if (q6->ip6q_prev->ip6q_ttl == 0) {
V_ip6stat.ip6s_fragtimeout++; IP6STAT_INC(ip6s_fragtimeout);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(q6->ip6q_prev); frag6_freef(q6->ip6q_prev);
} }
@ -755,7 +755,7 @@ frag6_slowtimo(void)
*/ */
while (V_frag6_nfragpackets > (u_int)V_ip6_maxfragpackets && while (V_frag6_nfragpackets > (u_int)V_ip6_maxfragpackets &&
V_ip6q.ip6q_prev) { V_ip6q.ip6q_prev) {
V_ip6stat.ip6s_fragoverflow++; IP6STAT_INC(ip6s_fragoverflow);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(V_ip6q.ip6q_prev); frag6_freef(V_ip6q.ip6q_prev);
} }
@ -781,7 +781,7 @@ frag6_drain(void)
VNET_FOREACH(vnet_iter) { VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter); CURVNET_SET(vnet_iter);
while (V_ip6q.ip6q_next != &V_ip6q) { while (V_ip6q.ip6q_next != &V_ip6q) {
V_ip6stat.ip6s_fragdropped++; IP6STAT_INC(ip6s_fragdropped);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(V_ip6q.ip6q_next); frag6_freef(V_ip6q.ip6q_next);
} }

View File

@ -299,14 +299,14 @@ in6_gif_input(struct mbuf **mp, int *offp, int proto)
sc = (struct gif_softc *)encap_getarg(m); sc = (struct gif_softc *)encap_getarg(m);
if (sc == NULL) { if (sc == NULL) {
m_freem(m); m_freem(m);
V_ip6stat.ip6s_nogif++; IP6STAT_INC(ip6s_nogif);
return IPPROTO_DONE; return IPPROTO_DONE;
} }
gifp = GIF2IFP(sc); gifp = GIF2IFP(sc);
if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) {
m_freem(m); m_freem(m);
V_ip6stat.ip6s_nogif++; IP6STAT_INC(ip6s_nogif);
return IPPROTO_DONE; return IPPROTO_DONE;
} }
@ -361,7 +361,7 @@ in6_gif_input(struct mbuf **mp, int *offp, int proto)
break; break;
default: default:
V_ip6stat.ip6s_nogif++; IP6STAT_INC(ip6s_nogif);
m_freem(m); m_freem(m);
return IPPROTO_DONE; return IPPROTO_DONE;
} }

View File

@ -153,7 +153,7 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
#define REPLACE(r) do {\ #define REPLACE(r) do {\
if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \
sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \
V_ip6stat.ip6s_sources_rule[(r)]++; \ IP6STAT_INC(ip6s_sources_rule[(r)]); \
/* { \ /* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \
@ -163,7 +163,7 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
#define NEXT(r) do {\ #define NEXT(r) do {\
if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \
sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \
V_ip6stat.ip6s_sources_rule[(r)]++; \ IP6STAT_INC(ip6s_sources_rule[(r)]); \
/* { \ /* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \
@ -173,7 +173,7 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
#define BREAK(r) do { \ #define BREAK(r) do { \
if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \
sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \
V_ip6stat.ip6s_sources_rule[(r)]++; \ IP6STAT_INC(ip6s_sources_rule[(r)]); \
goto out; /* XXX: we can't use 'break' here */ \ goto out; /* XXX: we can't use 'break' here */ \
} while(0) } while(0)
@ -734,7 +734,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
error = EHOSTUNREACH; error = EHOSTUNREACH;
} }
if (error == EHOSTUNREACH) if (error == EHOSTUNREACH)
V_ip6stat.ip6s_noroute++; IP6STAT_INC(ip6s_noroute);
if (retifp != NULL) { if (retifp != NULL) {
*retifp = ifp; *retifp = ifp;

View File

@ -135,7 +135,7 @@ ip6_forward(struct mbuf *m, int srcrt)
if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 || if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 ||
IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
/* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */
if (V_ip6_log_time + V_ip6_log_interval < time_second) { if (V_ip6_log_time + V_ip6_log_interval < time_second) {
V_ip6_log_time = time_second; V_ip6_log_time = time_second;
@ -183,7 +183,7 @@ ip6_forward(struct mbuf *m, int srcrt)
IP_FORWARDING, &error); IP_FORWARDING, &error);
if (sp == NULL) { if (sp == NULL) {
V_ipsec6stat.out_inval++; V_ipsec6stat.out_inval++;
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
if (mcopy) { if (mcopy) {
#if 0 #if 0
/* XXX: what icmp ? */ /* XXX: what icmp ? */
@ -204,7 +204,7 @@ ip6_forward(struct mbuf *m, int srcrt)
* This packet is just discarded. * This packet is just discarded.
*/ */
V_ipsec6stat.out_polvio++; V_ipsec6stat.out_polvio++;
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
KEY_FREESP(&sp); KEY_FREESP(&sp);
if (mcopy) { if (mcopy) {
#if 0 #if 0
@ -226,7 +226,7 @@ ip6_forward(struct mbuf *m, int srcrt)
if (sp->req == NULL) { if (sp->req == NULL) {
/* XXX should be panic ? */ /* XXX should be panic ? */
printf("ip6_forward: No IPsec request specified.\n"); printf("ip6_forward: No IPsec request specified.\n");
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
KEY_FREESP(&sp); KEY_FREESP(&sp);
if (mcopy) { if (mcopy) {
#if 0 #if 0
@ -310,7 +310,7 @@ ip6_forward(struct mbuf *m, int srcrt)
/* don't show these error codes to the user */ /* don't show these error codes to the user */
break; break;
} }
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
if (mcopy) { if (mcopy) {
#if 0 #if 0
/* XXX: what icmp ? */ /* XXX: what icmp ? */
@ -362,7 +362,7 @@ ip6_forward(struct mbuf *m, int srcrt)
if (rin6.ro_rt != NULL) if (rin6.ro_rt != NULL)
RT_UNLOCK(rin6.ro_rt); RT_UNLOCK(rin6.ro_rt);
else { else {
V_ip6stat.ip6s_noroute++; IP6STAT_INC(ip6s_noroute);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
if (mcopy) { if (mcopy) {
icmp6_error(mcopy, ICMP6_DST_UNREACH, icmp6_error(mcopy, ICMP6_DST_UNREACH,
@ -387,13 +387,13 @@ ip6_forward(struct mbuf *m, int srcrt)
src_in6 = ip6->ip6_src; src_in6 = ip6->ip6_src;
if (in6_setscope(&src_in6, rt->rt_ifp, &outzone)) { if (in6_setscope(&src_in6, rt->rt_ifp, &outzone)) {
/* XXX: this should not happen */ /* XXX: this should not happen */
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
if (in6_setscope(&src_in6, m->m_pkthdr.rcvif, &inzone)) { if (in6_setscope(&src_in6, m->m_pkthdr.rcvif, &inzone)) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
if (inzone != outzone if (inzone != outzone
@ -401,8 +401,8 @@ ip6_forward(struct mbuf *m, int srcrt)
&& !ipsecrt && !ipsecrt
#endif #endif
) { ) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard); in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard);
if (V_ip6_log_time + V_ip6_log_interval < time_second) { if (V_ip6_log_time + V_ip6_log_interval < time_second) {
@ -432,8 +432,8 @@ ip6_forward(struct mbuf *m, int srcrt)
if (in6_setscope(&dst_in6, m->m_pkthdr.rcvif, &inzone) != 0 || if (in6_setscope(&dst_in6, m->m_pkthdr.rcvif, &inzone) != 0 ||
in6_setscope(&dst_in6, rt->rt_ifp, &outzone) != 0 || in6_setscope(&dst_in6, rt->rt_ifp, &outzone) != 0 ||
inzone != outzone) { inzone != outzone) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
@ -623,12 +623,12 @@ ip6_forward(struct mbuf *m, int srcrt)
error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); error = nd6_output(rt->rt_ifp, origifp, m, dst, rt);
if (error) { if (error) {
in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard);
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
} else { } else {
V_ip6stat.ip6s_forward++; IP6STAT_INC(ip6s_forward);
in6_ifstat_inc(rt->rt_ifp, ifs6_out_forward); in6_ifstat_inc(rt->rt_ifp, ifs6_out_forward);
if (type) if (type)
V_ip6stat.ip6s_redirectsent++; IP6STAT_INC(ip6s_redirectsent);
else { else {
if (mcopy) if (mcopy)
goto freecopy; goto freecopy;

View File

@ -364,7 +364,7 @@ ip6_input_hbh(struct mbuf *m, uint32_t *plen, uint32_t *rtalert, int *off,
* contained, ip6_hopopts_input() must set a valid * contained, ip6_hopopts_input() must set a valid
* (non-zero) payload length to the variable plen. * (non-zero) payload length to the variable plen.
*/ */
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr);
icmp6_error(m, ICMP6_PARAM_PROB, icmp6_error(m, ICMP6_PARAM_PROB,
@ -379,7 +379,7 @@ ip6_input_hbh(struct mbuf *m, uint32_t *plen, uint32_t *rtalert, int *off,
IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr),
sizeof(struct ip6_hbh)); sizeof(struct ip6_hbh));
if (hbh == NULL) { if (hbh == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
goto out; goto out;
} }
#endif #endif
@ -462,20 +462,21 @@ ip6_input(struct mbuf *m)
*/ */
if (m->m_flags & M_EXT) { if (m->m_flags & M_EXT) {
if (m->m_next) if (m->m_next)
V_ip6stat.ip6s_mext2m++; IP6STAT_INC(ip6s_mext2m);
else else
V_ip6stat.ip6s_mext1++; IP6STAT_INC(ip6s_mext1);
} else { } else {
#define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0])) #define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0]))
if (m->m_next) { if (m->m_next) {
if (m->m_flags & M_LOOP) { if (m->m_flags & M_LOOP) {
V_ip6stat.ip6s_m2m[V_loif->if_index]++; IP6STAT_INC(ip6s_m2m[V_loif->if_index]);
} else if (m->m_pkthdr.rcvif->if_index < M2MMAX) } else if (m->m_pkthdr.rcvif->if_index < M2MMAX)
V_ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; IP6STAT_INC(
ip6s_m2m[m->m_pkthdr.rcvif->if_index]);
else else
V_ip6stat.ip6s_m2m[0]++; IP6STAT_INC(ip6s_m2m[0]);
} else } else
V_ip6stat.ip6s_m1++; IP6STAT_INC(ip6s_m1);
#undef M2MMAX #undef M2MMAX
} }
@ -486,7 +487,7 @@ ip6_input(struct mbuf *m)
} }
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive);
V_ip6stat.ip6s_total++; IP6STAT_INC(ip6s_total);
#ifndef PULLDOWN_TEST #ifndef PULLDOWN_TEST
/* /*
@ -519,7 +520,7 @@ ip6_input(struct mbuf *m)
struct ifnet *inifp; struct ifnet *inifp;
inifp = m->m_pkthdr.rcvif; inifp = m->m_pkthdr.rcvif;
if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
in6_ifstat_inc(inifp, ifs6_in_hdrerr); in6_ifstat_inc(inifp, ifs6_in_hdrerr);
return; return;
} }
@ -528,12 +529,12 @@ ip6_input(struct mbuf *m)
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
V_ip6stat.ip6s_badvers++; IP6STAT_INC(ip6s_badvers);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr);
goto bad; goto bad;
} }
V_ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]);
/* /*
* Check against address spoofing/corruption. * Check against address spoofing/corruption.
@ -543,7 +544,7 @@ ip6_input(struct mbuf *m)
/* /*
* XXX: "badscope" is not very suitable for a multicast source. * XXX: "badscope" is not very suitable for a multicast source.
*/ */
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
goto bad; goto bad;
} }
@ -555,7 +556,7 @@ ip6_input(struct mbuf *m)
* because ip6_mloopback() passes the "actual" interface * because ip6_mloopback() passes the "actual" interface
* as the outgoing/incoming interface. * as the outgoing/incoming interface.
*/ */
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
goto bad; goto bad;
} }
@ -580,7 +581,7 @@ ip6_input(struct mbuf *m)
*/ */
if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) ||
IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
goto bad; goto bad;
} }
@ -594,7 +595,7 @@ ip6_input(struct mbuf *m)
*/ */
if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) || if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) ||
IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
goto bad; goto bad;
} }
@ -657,12 +658,12 @@ ip6_input(struct mbuf *m)
* is not loopback. * is not loopback.
*/ */
if (in6_clearscope(&ip6->ip6_src) || in6_clearscope(&ip6->ip6_dst)) { if (in6_clearscope(&ip6->ip6_src) || in6_clearscope(&ip6->ip6_dst)) {
V_ip6stat.ip6s_badscope++; /* XXX */ IP6STAT_INC(ip6s_badscope); /* XXX */
goto bad; goto bad;
} }
if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) ||
in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
@ -866,7 +867,7 @@ ip6_input(struct mbuf *m)
* and we're not a router. * and we're not a router.
*/ */
if (!V_ip6_forwarding) { if (!V_ip6_forwarding) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
goto bad; goto bad;
} }
@ -920,7 +921,7 @@ ip6_input(struct mbuf *m)
* Drop packet if shorter than we expect. * Drop packet if shorter than we expect.
*/ */
if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);
goto bad; goto bad;
} }
@ -972,7 +973,7 @@ ip6_input(struct mbuf *m)
*/ */
if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) ||
IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
goto bad; goto bad;
} }
@ -980,13 +981,13 @@ ip6_input(struct mbuf *m)
/* /*
* Tell launch routine the next header * Tell launch routine the next header
*/ */
V_ip6stat.ip6s_delivered++; IP6STAT_INC(ip6s_delivered);
in6_ifstat_inc(deliverifp, ifs6_in_deliver); in6_ifstat_inc(deliverifp, ifs6_in_deliver);
nest = 0; nest = 0;
while (nxt != IPPROTO_DONE) { while (nxt != IPPROTO_DONE) {
if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) {
V_ip6stat.ip6s_toomanyhdr++; IP6STAT_INC(ip6s_toomanyhdr);
goto bad; goto bad;
} }
@ -995,7 +996,7 @@ ip6_input(struct mbuf *m)
* more sanity checks in header chain processing. * more sanity checks in header chain processing.
*/ */
if (m->m_pkthdr.len < off) { if (m->m_pkthdr.len < off) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);
goto bad; goto bad;
} }
@ -1089,14 +1090,14 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalertp,
IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m,
sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); sizeof(struct ip6_hdr), sizeof(struct ip6_hbh));
if (hbh == NULL) { if (hbh == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return -1; return -1;
} }
hbhlen = (hbh->ip6h_len + 1) << 3; hbhlen = (hbh->ip6h_len + 1) << 3;
IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr),
hbhlen); hbhlen);
if (hbh == NULL) { if (hbh == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return -1; return -1;
} }
#endif #endif
@ -1141,7 +1142,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
break; break;
case IP6OPT_PADN: case IP6OPT_PADN:
if (hbhlen < IP6OPT_MINLEN) { if (hbhlen < IP6OPT_MINLEN) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
goto bad; goto bad;
} }
optlen = *(opt + 1) + 2; optlen = *(opt + 1) + 2;
@ -1149,7 +1150,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
case IP6OPT_ROUTER_ALERT: case IP6OPT_ROUTER_ALERT:
/* XXX may need check for alignment */ /* XXX may need check for alignment */
if (hbhlen < IP6OPT_RTALERT_LEN) { if (hbhlen < IP6OPT_RTALERT_LEN) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
goto bad; goto bad;
} }
if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) { if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) {
@ -1166,7 +1167,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
case IP6OPT_JUMBO: case IP6OPT_JUMBO:
/* XXX may need check for alignment */ /* XXX may need check for alignment */
if (hbhlen < IP6OPT_JUMBO_LEN) { if (hbhlen < IP6OPT_JUMBO_LEN) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
goto bad; goto bad;
} }
if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) { if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) {
@ -1184,7 +1185,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
*/ */
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
if (ip6->ip6_plen) { if (ip6->ip6_plen) {
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, icmp6_error(m, ICMP6_PARAM_PROB,
ICMP6_PARAMPROB_HEADER, ICMP6_PARAMPROB_HEADER,
erroff + opt - opthead); erroff + opt - opthead);
@ -1208,7 +1209,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
* there's no explicit mention in specification. * there's no explicit mention in specification.
*/ */
if (*plenp != 0) { if (*plenp != 0) {
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, icmp6_error(m, ICMP6_PARAM_PROB,
ICMP6_PARAMPROB_HEADER, ICMP6_PARAMPROB_HEADER,
erroff + opt + 2 - opthead); erroff + opt + 2 - opthead);
@ -1220,7 +1221,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
* jumbo payload length must be larger than 65535. * jumbo payload length must be larger than 65535.
*/ */
if (jumboplen <= IPV6_MAXPACKET) { if (jumboplen <= IPV6_MAXPACKET) {
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, icmp6_error(m, ICMP6_PARAM_PROB,
ICMP6_PARAMPROB_HEADER, ICMP6_PARAMPROB_HEADER,
erroff + opt + 2 - opthead); erroff + opt + 2 - opthead);
@ -1231,7 +1232,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
break; break;
default: /* unknown option */ default: /* unknown option */
if (hbhlen < IP6OPT_MINLEN) { if (hbhlen < IP6OPT_MINLEN) {
V_ip6stat.ip6s_toosmall++; IP6STAT_INC(ip6s_toosmall);
goto bad; goto bad;
} }
optlen = ip6_unknown_opt(opt, m, optlen = ip6_unknown_opt(opt, m,
@ -1268,11 +1269,11 @@ ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off)
m_freem(m); m_freem(m);
return (-1); return (-1);
case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */ case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off);
return (-1); return (-1);
case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */ case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
(m->m_flags & (M_BCAST|M_MCAST))) (m->m_flags & (M_BCAST|M_MCAST)))
@ -1451,14 +1452,14 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr),
ip6->ip6_nxt); ip6->ip6_nxt);
if (ext == NULL) { if (ext == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return; return;
} }
hbh = mtod(ext, struct ip6_hbh *); hbh = mtod(ext, struct ip6_hbh *);
hbhlen = (hbh->ip6h_len + 1) << 3; hbhlen = (hbh->ip6h_len + 1) << 3;
if (hbhlen != ext->m_len) { if (hbhlen != ext->m_len) {
m_freem(ext); m_freem(ext);
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return; return;
} }
#endif #endif
@ -1525,7 +1526,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
#else #else
ext = ip6_pullexthdr(m, off, nxt); ext = ip6_pullexthdr(m, off, nxt);
if (ext == NULL) { if (ext == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return; return;
} }
ip6e = mtod(ext, struct ip6_ext *); ip6e = mtod(ext, struct ip6_ext *);
@ -1535,7 +1536,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
elen = (ip6e->ip6e_len + 1) << 3; elen = (ip6e->ip6e_len + 1) << 3;
if (elen != ext->m_len) { if (elen != ext->m_len) {
m_freem(ext); m_freem(ext);
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return; return;
} }
#endif #endif

View File

@ -149,7 +149,7 @@ ip6_ipsec_fwd(struct mbuf *m)
error = ipsec_in_reject(sp, m); error = ipsec_in_reject(sp, m);
KEY_FREESP(&sp); KEY_FREESP(&sp);
if (error) { if (error) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
return 1; return 1;
} }
#endif /* IPSEC */ #endif /* IPSEC */

View File

@ -1100,7 +1100,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
* (although such packets must normally set 1 to the hop limit field). * (although such packets must normally set 1 to the hop limit field).
*/ */
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
V_ip6stat.ip6s_cantforward++; IP6STAT_INC(ip6s_cantforward);
if (V_ip6_log_time + V_ip6_log_interval < time_second) { if (V_ip6_log_time + V_ip6_log_interval < time_second) {
V_ip6_log_time = time_second; V_ip6_log_time = time_second;
log(LOG_DEBUG, log(LOG_DEBUG,
@ -1535,7 +1535,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
dst0 = ip6->ip6_dst; dst0 = ip6->ip6_dst;
if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 || if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 ||
(error = in6_setscope(&dst0, ifp, &idzone)) != 0) { (error = in6_setscope(&dst0, ifp, &idzone)) != 0) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
return (error); return (error);
} }
for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) { for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) {
@ -1555,7 +1555,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
&odzone) || &odzone) ||
iszone != oszone || iszone != oszone ||
idzone != odzone) { idzone != odzone) {
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
continue; continue;
} }
} }

View File

@ -498,16 +498,16 @@ skip_ipsec2:;
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) &&
(flags & IPV6_UNSPECSRC) == 0) { (flags & IPV6_UNSPECSRC) == 0) {
error = EOPNOTSUPP; error = EOPNOTSUPP;
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) {
error = EOPNOTSUPP; error = EOPNOTSUPP;
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
goto bad; goto bad;
} }
V_ip6stat.ip6s_localout++; IP6STAT_INC(ip6s_localout);
/* /*
* Route packet. * Route packet.
@ -713,7 +713,7 @@ skip_ipsec2:;
goto routefound; goto routefound;
badscope: badscope:
V_ip6stat.ip6s_badscope++; IP6STAT_INC(ip6s_badscope);
in6_ifstat_inc(origifp, ifs6_out_discard); in6_ifstat_inc(origifp, ifs6_out_discard);
if (error == 0) if (error == 0)
error = EHOSTUNREACH; /* XXX */ error = EHOSTUNREACH; /* XXX */
@ -742,7 +742,7 @@ skip_ipsec2:;
* Confirm that the outgoing interface supports multicast. * Confirm that the outgoing interface supports multicast.
*/ */
if (!(ifp->if_flags & IFF_MULTICAST)) { if (!(ifp->if_flags & IFF_MULTICAST)) {
V_ip6stat.ip6s_noroute++; IP6STAT_INC(ip6s_noroute);
in6_ifstat_inc(ifp, ifs6_out_discard); in6_ifstat_inc(ifp, ifs6_out_discard);
error = ENETUNREACH; error = ENETUNREACH;
goto bad; goto bad;
@ -1073,7 +1073,7 @@ skip_ipsec2:;
if (qslots <= 0 || ((u_int)qslots * (mtu - hlen) if (qslots <= 0 || ((u_int)qslots * (mtu - hlen)
< tlen /* - hlen */)) { < tlen /* - hlen */)) {
error = ENOBUFS; error = ENOBUFS;
V_ip6stat.ip6s_odropped++; IP6STAT_INC(ip6s_odropped);
goto bad; goto bad;
} }
@ -1123,7 +1123,7 @@ skip_ipsec2:;
m = m_gethdr(M_NOWAIT, MT_DATA); m = m_gethdr(M_NOWAIT, MT_DATA);
if (!m) { if (!m) {
error = ENOBUFS; error = ENOBUFS;
V_ip6stat.ip6s_odropped++; IP6STAT_INC(ip6s_odropped);
goto sendorfree; goto sendorfree;
} }
m->m_flags = m0->m_flags & M_COPYFLAGS; /* incl. FIB */ m->m_flags = m0->m_flags & M_COPYFLAGS; /* incl. FIB */
@ -1135,7 +1135,7 @@ skip_ipsec2:;
m->m_len = sizeof(*mhip6); m->m_len = sizeof(*mhip6);
error = ip6_insertfraghdr(m0, m, hlen, &ip6f); error = ip6_insertfraghdr(m0, m, hlen, &ip6f);
if (error) { if (error) {
V_ip6stat.ip6s_odropped++; IP6STAT_INC(ip6s_odropped);
goto sendorfree; goto sendorfree;
} }
ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7));
@ -1147,7 +1147,7 @@ skip_ipsec2:;
sizeof(*ip6f) - sizeof(struct ip6_hdr))); sizeof(*ip6f) - sizeof(struct ip6_hdr)));
if ((m_frgpart = m_copy(m0, off, len)) == 0) { if ((m_frgpart = m_copy(m0, off, len)) == 0) {
error = ENOBUFS; error = ENOBUFS;
V_ip6stat.ip6s_odropped++; IP6STAT_INC(ip6s_odropped);
goto sendorfree; goto sendorfree;
} }
m_cat(m, m_frgpart); m_cat(m, m_frgpart);
@ -1156,7 +1156,7 @@ skip_ipsec2:;
ip6f->ip6f_reserved = 0; ip6f->ip6f_reserved = 0;
ip6f->ip6f_ident = id; ip6f->ip6f_ident = id;
ip6f->ip6f_nxt = nextproto; ip6f->ip6f_nxt = nextproto;
V_ip6stat.ip6s_ofragments++; IP6STAT_INC(ip6s_ofragments);
in6_ifstat_inc(ifp, ifs6_out_fragcreat); in6_ifstat_inc(ifp, ifs6_out_fragcreat);
} }
@ -1185,7 +1185,7 @@ skip_ipsec2:;
} }
if (error == 0) if (error == 0)
V_ip6stat.ip6s_fragmented++; IP6STAT_INC(ip6s_fragmented);
done: done:
if (ro == &ip6route) if (ro == &ip6route)

View File

@ -296,7 +296,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
if ((last != NULL) && ipsec6_in_reject(m, last)) { if ((last != NULL) && ipsec6_in_reject(m, last)) {
m_freem(m); m_freem(m);
V_ipsec6stat.in_polvio++; V_ipsec6stat.in_polvio++;
V_ip6stat.ip6s_delivered--; IP6STAT_DEC(ip6s_delivered);
/* Do not inject data into pcb. */ /* Do not inject data into pcb. */
INP_RUNLOCK(last); INP_RUNLOCK(last);
} else } else
@ -328,7 +328,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
ICMP6_PARAMPROB_NEXTHEADER, ICMP6_PARAMPROB_NEXTHEADER,
prvnxtp - mtod(m, char *)); prvnxtp - mtod(m, char *));
} }
V_ip6stat.ip6s_delivered--; IP6STAT_DEC(ip6s_delivered);
} }
return (IPPROTO_DONE); return (IPPROTO_DONE);
} }

View File

@ -69,7 +69,7 @@ route6_input(struct mbuf **mp, int *offp, int proto)
if (ip6a) { if (ip6a) {
/* XXX reject home-address option before rthdr */ /* XXX reject home-address option before rthdr */
if (ip6a->ip6a_flags & IP6A_SWAP) { if (ip6a->ip6a_flags & IP6A_SWAP) {
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
m_freem(m); m_freem(m);
return IPPROTO_DONE; return IPPROTO_DONE;
} }
@ -84,7 +84,7 @@ route6_input(struct mbuf **mp, int *offp, int proto)
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh));
if (rh == NULL) { if (rh == NULL) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
return IPPROTO_DONE; return IPPROTO_DONE;
} }
#endif #endif
@ -100,7 +100,7 @@ route6_input(struct mbuf **mp, int *offp, int proto)
rhlen = (rh->ip6r_len + 1) << 3; rhlen = (rh->ip6r_len + 1) << 3;
break; /* Final dst. Just ignore the header. */ break; /* Final dst. Just ignore the header. */
} }
V_ip6stat.ip6s_badoptions++; IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
(caddr_t)&rh->ip6r_type - (caddr_t)ip6); (caddr_t)&rh->ip6r_type - (caddr_t)ip6);
return (IPPROTO_DONE); return (IPPROTO_DONE);

View File

@ -768,7 +768,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
nxt = nxt8; nxt = nxt8;
while (nxt != IPPROTO_DONE) { while (nxt != IPPROTO_DONE) {
if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) {
V_ip6stat.ip6s_toomanyhdr++; IP6STAT_INC(ip6s_toomanyhdr);
error = EINVAL; error = EINVAL;
goto bad; goto bad;
} }
@ -778,7 +778,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
* more sanity checks in header chain processing. * more sanity checks in header chain processing.
*/ */
if (m->m_pkthdr.len < skip) { if (m->m_pkthdr.len < skip) {
V_ip6stat.ip6s_tooshort++; IP6STAT_INC(ip6s_tooshort);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);
error = EINVAL; error = EINVAL;
goto bad; goto bad;

View File

@ -863,7 +863,7 @@ ipsec6_output_tunnel(struct ipsec_output_state *state, struct secpolicy *sp, int
rtalloc_ign_fib(state->ro, 0UL, M_GETFIB(m)); rtalloc_ign_fib(state->ro, 0UL, M_GETFIB(m));
} }
if (state->ro->ro_rt == NULL) { if (state->ro->ro_rt == NULL) {
V_ip6stat.ip6s_noroute++; IP6STAT_INC(ip6s_noroute);
V_ipsec6stat.ips_out_noroute++; V_ipsec6stat.ips_out_noroute++;
error = EHOSTUNREACH; error = EHOSTUNREACH;
goto bad; goto bad;