The diff below renames the members of struct etheripstat to match other *stat counters: "etherip_foo" -> "etherips_foo". It also moves them all to u_int64_t to mkae the conversion to percpu counters cleaner.
https://codesearch.debian.net/search?q=etheripstat returns no match and shells/nsh doesn't use this, so I think it's safe ports-wise - I can handle the fallout anyway. ok? Index: net/if_etherip.c =================================================================== RCS file: /d/cvs/src/sys/net/if_etherip.c,v retrieving revision 1.14 diff -u -p -r1.14 if_etherip.c --- net/if_etherip.c 29 Jan 2017 19:58:47 -0000 1.14 +++ net/if_etherip.c 7 Mar 2017 17:28:35 -0000 @@ -366,7 +366,7 @@ ip_etherip_output(struct ifnet *ifp, str M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return ENOBUFS; } eip = mtod(m, struct etherip_header *); @@ -376,7 +376,7 @@ ip_etherip_output(struct ifnet *ifp, str M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return ENOBUFS; } ip = mtod(m, struct ip *); @@ -397,8 +397,8 @@ ip_etherip_output(struct ifnet *ifp, str #if NPF > 0 pf_pkt_addr_changed(m); #endif - etheripstat.etherip_opackets++; - etheripstat.etherip_obytes += (m->m_pkthdr.len - + etheripstat.etherips_opackets++; + etheripstat.etherips_obytes += (m->m_pkthdr.len - (sizeof(struct ip) + sizeof(struct etherip_header))); return ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL, 0); @@ -425,7 +425,7 @@ ip_etherip_input(struct mbuf **mp, int * if (!etherip_allow) { m_freem(m); - etheripstat.etherip_pdrops++; + etheripstat.etherips_pdrops++; return IPPROTO_DONE; } @@ -455,7 +455,7 @@ ip_etherip_input(struct mbuf **mp, int * */ return etherip_input(mp, offp, proto); #else - etheripstat.etherip_noifdrops++; + etheripstat.etherips_noifdrops++; m_freem(m); return IPPROTO_DONE; #endif /* NGIF */ @@ -464,25 +464,25 @@ ip_etherip_input(struct mbuf **mp, int * m_adj(m, *offp); m = m_pullup(m, sizeof(struct etherip_header)); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return IPPROTO_DONE; } eip = mtod(m, struct etherip_header *); if (eip->eip_ver != ETHERIP_VERSION || eip->eip_pad) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return IPPROTO_DONE; } - etheripstat.etherip_ipackets++; - etheripstat.etherip_ibytes += (m->m_pkthdr.len - + etheripstat.etherips_ipackets++; + etheripstat.etherips_ibytes += (m->m_pkthdr.len - sizeof(struct etherip_header)); m_adj(m, sizeof(struct etherip_header)); m = m_pullup(m, sizeof(struct ether_header)); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return IPPROTO_DONE; } m->m_flags &= ~(M_BCAST|M_MCAST); @@ -523,7 +523,7 @@ ip6_etherip_output(struct ifnet *ifp, st M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return ENOBUFS; } eip = mtod(m, struct etherip_header *); @@ -533,7 +533,7 @@ ip6_etherip_output(struct ifnet *ifp, st M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return ENOBUFS; } ip6 = mtod(m, struct ip6_hdr *); @@ -555,8 +555,8 @@ ip6_etherip_output(struct ifnet *ifp, st #if NPF > 0 pf_pkt_addr_changed(m); #endif - etheripstat.etherip_opackets++; - etheripstat.etherip_obytes += (m->m_pkthdr.len - + etheripstat.etherips_opackets++; + etheripstat.etherips_obytes += (m->m_pkthdr.len - (sizeof(struct ip6_hdr) + sizeof(struct etherip_header))); return ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL); @@ -581,7 +581,7 @@ ip6_etherip_input(struct mbuf **mp, int if (!etherip_allow) { m_freem(m); - etheripstat.etherip_pdrops++; + etheripstat.etherips_pdrops++; return IPPROTO_NONE; } @@ -615,7 +615,7 @@ ip6_etherip_input(struct mbuf **mp, int */ return etherip_input(mp, offp, proto); #else - etheripstat.etherip_noifdrops++; + etheripstat.etherips_noifdrops++; m_freem(m); return IPPROTO_DONE; #endif /* NGIF */ @@ -624,24 +624,24 @@ ip6_etherip_input(struct mbuf **mp, int m_adj(m, *offp); m = m_pullup(m, sizeof(struct etherip_header)); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return IPPROTO_DONE; } eip = mtod(m, struct etherip_header *); if ((eip->eip_ver != ETHERIP_VERSION) || eip->eip_pad) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return IPPROTO_DONE; } - etheripstat.etherip_ipackets++; - etheripstat.etherip_ibytes += (m->m_pkthdr.len - + etheripstat.etherips_ipackets++; + etheripstat.etherips_ibytes += (m->m_pkthdr.len - sizeof(struct etherip_header)); m_adj(m, sizeof(struct etherip_header)); m = m_pullup(m, sizeof(struct ether_header)); if (m == NULL) { - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return IPPROTO_DONE; } Index: netinet/ip_ether.c =================================================================== RCS file: /d/cvs/src/sys/netinet/ip_ether.c,v retrieving revision 1.83 diff -u -p -r1.83 ip_ether.c --- netinet/ip_ether.c 29 Jan 2017 19:58:47 -0000 1.83 +++ netinet/ip_ether.c 7 Mar 2017 17:31:37 -0000 @@ -96,7 +96,7 @@ etherip_input(struct mbuf **mp, int *off /* If we do not accept EtherIP explicitly, drop. */ if (!etherip_allow && ((*mp)->m_flags & (M_AUTH|M_CONF)) == 0) { DPRINTF(("etherip_input(): dropped due to policy\n")); - etheripstat.etherip_pdrops++; + etheripstat.etherips_pdrops++; m_freem(*mp); return IPPROTO_DONE; } @@ -110,7 +110,7 @@ etherip_input(struct mbuf **mp, int *off #endif default: DPRINTF(("etherip_input(): dropped, unhandled protocol\n")); - etheripstat.etherip_pdrops++; + etheripstat.etherips_pdrops++; m_freem(*mp); return IPPROTO_DONE; } @@ -124,7 +124,7 @@ etherip_decap(struct mbuf *m, int iphlen struct gif_softc *sc; struct mbuf_list ml = MBUF_LIST_INITIALIZER(); - etheripstat.etherip_ipackets++; + etheripstat.etherips_ipackets++; /* * Make sure there's at least an ethernet header's and an EtherIP @@ -133,7 +133,7 @@ etherip_decap(struct mbuf *m, int iphlen if (m->m_pkthdr.len < iphlen + sizeof(struct ether_header) + sizeof(struct etherip_header)) { DPRINTF(("etherip_input(): encapsulated packet too short\n")); - etheripstat.etherip_hdrops++; + etheripstat.etherips_hdrops++; m_freem(m); return; } @@ -145,7 +145,7 @@ etherip_decap(struct mbuf *m, int iphlen } else { DPRINTF(("etherip_input(): received EtherIP version number " "%d not suppoorted\n", eip.eip_ver)); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return; } @@ -154,7 +154,7 @@ etherip_decap(struct mbuf *m, int iphlen if (eip.eip_pad) { DPRINTF(("etherip_input(): received EtherIP invalid " "pad value\n")); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return; } @@ -165,7 +165,7 @@ etherip_decap(struct mbuf *m, int iphlen if ((m = m_pullup(m, iphlen + sizeof(struct ether_header) + sizeof(struct etherip_header))) == NULL) { DPRINTF(("etherip_input(): m_pullup() failed\n")); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return; } } @@ -175,7 +175,7 @@ etherip_decap(struct mbuf *m, int iphlen return; if (sc->gif_if.if_bridgeport == NULL) { DPRINTF(("etherip_input(): interface not part of bridge\n")); - etheripstat.etherip_noifdrops++; + etheripstat.etherips_noifdrops++; m_freem(m); return; } @@ -184,7 +184,7 @@ etherip_decap(struct mbuf *m, int iphlen m_adj(m, iphlen + sizeof(struct etherip_header)); /* Statistics */ - etheripstat.etherip_ibytes += m->m_pkthdr.len; + etheripstat.etherips_ibytes += m->m_pkthdr.len; /* Reset the flags based on the inner packet */ m->m_flags &= ~(M_BCAST|M_MCAST|M_AUTH|M_CONF|M_PROTO1); @@ -204,7 +204,7 @@ mplsip_decap(struct mbuf *m, int iphlen) { struct gif_softc *sc; - etheripstat.etherip_ipackets++; + etheripstat.etherips_ipackets++; /* * Make sure there's at least one MPLS label worth of data after @@ -212,7 +212,7 @@ mplsip_decap(struct mbuf *m, int iphlen) */ if (m->m_pkthdr.len < iphlen + sizeof(struct shim_hdr)) { DPRINTF(("mplsip_input(): encapsulated packet too short\n")); - etheripstat.etherip_hdrops++; + etheripstat.etherips_hdrops++; m_freem(m); return; } @@ -222,7 +222,7 @@ mplsip_decap(struct mbuf *m, int iphlen) if ((m = m_pullup(m, iphlen + sizeof(struct shim_hdr))) == NULL) { DPRINTF(("mplsip_input(): m_pullup() failed\n")); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return; } } @@ -235,7 +235,7 @@ mplsip_decap(struct mbuf *m, int iphlen) m_adj(m, iphlen); /* Statistics */ - etheripstat.etherip_ibytes += m->m_pkthdr.len; + etheripstat.etherips_ibytes += m->m_pkthdr.len; /* Reset the flags based */ m->m_flags &= ~(M_BCAST|M_MCAST); @@ -293,7 +293,7 @@ etherip_getgif(struct mbuf *m) default: DPRINTF(("etherip_input(): invalid protocol %d\n", v)); m_freem(m); - etheripstat.etherip_hdrops++; + etheripstat.etherips_hdrops++; return NULL; } @@ -312,7 +312,7 @@ etherip_getgif(struct mbuf *m) /* None found. */ if (sc == NULL) { DPRINTF(("etherip_input(): no interface found\n")); - etheripstat.etherip_noifdrops++; + etheripstat.etherips_noifdrops++; m_freem(m); return NULL; } @@ -336,7 +336,7 @@ etherip_output(struct mbuf *m, struct td (tdb->tdb_src.sa.sa_family != AF_INET6)) { DPRINTF(("etherip_output(): IP in protocol-family <%d> " "attempted, aborting", tdb->tdb_src.sa.sa_family)); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return EINVAL; } @@ -345,7 +345,7 @@ etherip_output(struct mbuf *m, struct td (tdb->tdb_dst.sa.sa_family != AF_INET6)) { DPRINTF(("etherip_output(): IP in protocol-family <%d> " "attempted, aborting", tdb->tdb_dst.sa.sa_family)); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return EINVAL; } @@ -354,7 +354,7 @@ etherip_output(struct mbuf *m, struct td DPRINTF(("etherip_output(): mismatch in tunnel source and " "destination address protocol families (%d/%d), aborting", tdb->tdb_src.sa.sa_family, tdb->tdb_dst.sa.sa_family)); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return EINVAL; } @@ -371,7 +371,7 @@ etherip_output(struct mbuf *m, struct td default: DPRINTF(("etherip_output(): unsupported tunnel protocol " "family <%d>, aborting", tdb->tdb_dst.sa.sa_family)); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; m_freem(m); return EINVAL; } @@ -383,7 +383,7 @@ etherip_output(struct mbuf *m, struct td M_PREPEND(m, hlen, M_DONTWAIT); if (m == NULL) { DPRINTF(("etherip_output(): M_PREPEND failed\n")); - etheripstat.etherip_adrops++; + etheripstat.etherips_adrops++; return ENOBUFS; } @@ -400,8 +400,8 @@ etherip_output(struct mbuf *m, struct td } /* Statistics */ - etheripstat.etherip_opackets++; - etheripstat.etherip_obytes += m->m_pkthdr.len - hlen; + etheripstat.etherips_opackets++; + etheripstat.etherips_obytes += m->m_pkthdr.len - hlen; switch (tdb->tdb_dst.sa.sa_family) { case AF_INET: Index: netinet/ip_ether.h =================================================================== RCS file: /d/cvs/src/sys/netinet/ip_ether.h,v retrieving revision 1.20 diff -u -p -r1.20 ip_ether.h --- netinet/ip_ether.h 29 Jan 2017 19:58:47 -0000 1.20 +++ netinet/ip_ether.h 7 Mar 2017 14:31:52 -0000 @@ -30,15 +30,15 @@ */ struct etheripstat { - u_int32_t etherip_hdrops; /* packet shorter than header shows */ - u_int32_t etherip_qfull; /* bridge queue full, packet dropped */ - u_int32_t etherip_noifdrops; /* no interface/bridge information */ - u_int32_t etherip_pdrops; /* packet dropped due to policy */ - u_int32_t etherip_adrops; /* all other drops */ - u_int32_t etherip_ipackets; /* total input packets */ - u_int32_t etherip_opackets; /* total output packets */ - u_int64_t etherip_ibytes; /* input bytes */ - u_int64_t etherip_obytes; /* output bytes */ + u_int64_t etherips_hdrops; /* packet shorter than header shows */ + u_int64_t etherips_qfull; /* bridge queue full, packet dropped */ + u_int64_t etherips_noifdrops; /* no interface/bridge information */ + u_int64_t etherips_pdrops; /* packet dropped due to policy */ + u_int64_t etherips_adrops; /* all other drops */ + u_int64_t etherips_ipackets; /* total input packets */ + u_int64_t etherips_opackets; /* total output packets */ + u_int64_t etherips_ibytes; /* input bytes */ + u_int64_t etherips_obytes; /* output bytes */ }; struct etherip_header { -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE