From b331a82b584c0e495724058b90fe188906b5dec3 Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 29 Jan 2020 04:37:24 +0000 Subject: [PATCH] Adopt . --- sys/netinet/in_l2tp.c | 6 +++--- sys/netinet/ip_carp.c | 31 ++++++++++++++----------------- sys/netinet6/in6_l2tp.c | 6 +++--- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/sys/netinet/in_l2tp.c b/sys/netinet/in_l2tp.c index 1e5003b5e990..b321017e2e8a 100644 --- a/sys/netinet/in_l2tp.c +++ b/sys/netinet/in_l2tp.c @@ -1,4 +1,4 @@ -/* $NetBSD: in_l2tp.c,v 1.17 2019/09/19 06:07:25 knakahara Exp $ */ +/* $NetBSD: in_l2tp.c,v 1.18 2020/01/29 04:37:24 thorpej Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.17 2019/09/19 06:07:25 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.18 2020/01/29 04:37:24 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_l2tp.h" @@ -239,7 +239,7 @@ in_l2tp_output(struct l2tp_variant *var, struct mbuf *m) looped: if (error) - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); out: return error; diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index db37e94d15e9..f4a0442e9156 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.107 2020/01/20 18:38:22 thorpej Exp $ */ +/* $NetBSD: ip_carp.c,v 1.108 2020/01/29 04:37:24 thorpej Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.107 2020/01/20 18:38:22 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.108 2020/01/29 04:37:24 thorpej Exp $"); /* * TODO: @@ -712,13 +712,12 @@ carp_proto_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) } nanotime(&sc->sc_if.if_lastchange); - sc->sc_if.if_ipackets++; - sc->sc_if.if_ibytes += m->m_pkthdr.len; + if_statadd2(&sc->sc_if, if_ipackets, 1, if_ibytes, m->m_pkthdr.len); /* verify the CARP version. */ if (ch->carp_version != CARP_VERSION) { CARP_STATINC(CARP_STAT_BADVER); - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); CARP_LOG(sc, ("invalid version %d != %d", ch->carp_version, CARP_VERSION)); m_freem(m); @@ -735,7 +734,7 @@ carp_proto_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) #endif CARP_STATINC(CARP_STAT_BADAUTH); - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); switch(af) { case AF_INET: @@ -1038,7 +1037,7 @@ carp_send_ad(void *v) advbase = advskew = 0; /* Sssssh compiler */ if (sc->sc_carpdev == NULL) { - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); goto retry_later; } @@ -1075,7 +1074,7 @@ carp_send_ad(void *v) MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) { - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); CARP_STATINC(CARP_STAT_ONOMEM); /* XXX maybe less ? */ goto retry_later; @@ -1119,8 +1118,7 @@ carp_send_ad(void *v) m->m_data -= sizeof(*ip); nanotime(&sc->sc_if.if_lastchange); - sc->sc_if.if_opackets++; - sc->sc_if.if_obytes += len; + if_statadd2(&sc->sc_if, if_opackets, 1, if_obytes, len); CARP_STATINC(CARP_STAT_OPACKETS); error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, @@ -1130,7 +1128,7 @@ carp_send_ad(void *v) CARP_STATINC(CARP_STAT_ONOMEM); else CARP_LOG(sc, ("ip_output failed: %d", error)); - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); if (sc->sc_sendad_errors < INT_MAX) sc->sc_sendad_errors++; if (sc->sc_sendad_errors == CARP_SENDAD_MAX_ERRORS) { @@ -1159,7 +1157,7 @@ carp_send_ad(void *v) MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) { - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); CARP_STATINC(CARP_STAT_ONOMEM); /* XXX maybe less ? */ goto retry_later; @@ -1193,7 +1191,7 @@ carp_send_ad(void *v) ip6->ip6_dst.s6_addr16[0] = htons(0xff02); ip6->ip6_dst.s6_addr8[15] = 0x12; if (in6_setscope(&ip6->ip6_dst, &sc->sc_if, NULL) != 0) { - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); m_freem(m); CARP_LOG(sc, ("in6_setscope failed")); goto retry_later; @@ -1207,8 +1205,7 @@ carp_send_ad(void *v) len - sizeof(*ip6)); nanotime(&sc->sc_if.if_lastchange); - sc->sc_if.if_opackets++; - sc->sc_if.if_obytes += len; + if_statadd2(&sc->sc_if, if_opackets, 1, if_obytes, len); CARP_STATINC(CARP_STAT_OPACKETS6); error = ip6_output(m, NULL, NULL, 0, &sc->sc_im6o, NULL, NULL); @@ -1217,7 +1214,7 @@ carp_send_ad(void *v) CARP_STATINC(CARP_STAT_ONOMEM); else CARP_LOG(sc, ("ip6_output failed: %d", error)); - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); if (sc->sc_sendad_errors < INT_MAX) sc->sc_sendad_errors++; if (sc->sc_sendad_errors == CARP_SENDAD_MAX_ERRORS) { @@ -1509,7 +1506,7 @@ carp_input(struct mbuf *m, u_int8_t *shost, u_int8_t *dhost, u_int16_t etype) m_set_rcvif(m, ifp); bpf_mtap(ifp, m, BPF_D_IN); - ifp->if_ipackets++; + if_statinc(ifp, if_ipackets); ether_input(ifp, m); return (0); } diff --git a/sys/netinet6/in6_l2tp.c b/sys/netinet6/in6_l2tp.c index 76b7a7950959..a5a1a437e01d 100644 --- a/sys/netinet6/in6_l2tp.c +++ b/sys/netinet6/in6_l2tp.c @@ -1,4 +1,4 @@ -/* $NetBSD: in6_l2tp.c,v 1.18 2019/09/19 06:07:25 knakahara Exp $ */ +/* $NetBSD: in6_l2tp.c,v 1.19 2020/01/29 04:38:06 thorpej Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.18 2019/09/19 06:07:25 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.19 2020/01/29 04:38:06 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_l2tp.h" @@ -231,7 +231,7 @@ in6_l2tp_output(struct l2tp_variant *var, struct mbuf *m) looped: if (error) - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return error; }