diff options
-rw-r--r-- | sys/net/if_etherip.c | 46 | ||||
-rw-r--r-- | sys/netinet/ip_ether.c | 46 | ||||
-rw-r--r-- | sys/netinet/ip_ether.h | 20 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 20 |
4 files changed, 66 insertions, 66 deletions
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c index 16328a5e3d8..47a0e90e197 100644 --- a/sys/net/if_etherip.c +++ b/sys/net/if_etherip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_etherip.c,v 1.14 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: if_etherip.c,v 1.15 2017/03/07 23:35:06 jca Exp $ */ /* * Copyright (c) 2015 Kazuya GODA <goda@openbsd.org> * @@ -366,7 +366,7 @@ ip_etherip_output(struct ifnet *ifp, struct mbuf *m) 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, struct mbuf *m) 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, struct mbuf *m) #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 *offp, int proto) 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 *offp, int proto) */ 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 *offp, int proto) 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, struct mbuf *m) 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, struct mbuf *m) 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, struct mbuf *m) #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 *offp, int proto) 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 *offp, int proto) */ 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 *offp, int proto) 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; } diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index d8213651e08..e64e4a89bc3 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.83 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.84 2017/03/07 23:35:06 jca Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -96,7 +96,7 @@ etherip_input(struct mbuf **mp, int *offp, int proto) /* 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 *offp, int proto) #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 tdb *tdb, struct mbuf **mp, int proto) (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 tdb *tdb, struct mbuf **mp, int proto) (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 tdb *tdb, struct mbuf **mp, int proto) 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 tdb *tdb, struct mbuf **mp, int proto) 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 tdb *tdb, struct mbuf **mp, int proto) 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 tdb *tdb, struct mbuf **mp, int proto) } /* 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: diff --git a/sys/netinet/ip_ether.h b/sys/netinet/ip_ether.h index 89b244ee863..fcffa66de56 100644 --- a/sys/netinet/ip_ether.h +++ b/sys/netinet/ip_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.h,v 1.20 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip_ether.h,v 1.21 2017/03/07 23:35:06 jca Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@adk.gr) * @@ -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 { diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 8be9524e1a0..e7ce2a96d70 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.155 2017/02/20 17:04:25 jca Exp $ */ +/* $OpenBSD: inet.c,v 1.156 2017/03/07 23:35:06 jca Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -983,15 +983,15 @@ etherip_stats(char *name) #define p(f, m) if (etheripstat.f || sflag <= 1) \ printf(m, etheripstat.f, plural(etheripstat.f)) - p(etherip_hdrops, "\t%u packet%s shorter than header shows\n"); - p(etherip_qfull, "\t%u packet%s were dropped due to full output queue\n"); - p(etherip_noifdrops, "\t%u packet%s were dropped because of no interface/bridge information\n"); - p(etherip_pdrops, "\t%u packet%s dropped due to policy\n"); - p(etherip_adrops, "\t%u packet%s dropped for other reasons\n"); - p(etherip_ipackets, "\t%u input ethernet-in-IP packet%s\n"); - p(etherip_opackets, "\t%u output ethernet-in-IP packet%s\n"); - p(etherip_ibytes, "\t%llu input byte%s\n"); - p(etherip_obytes, "\t%llu output byte%s\n"); + p(etherips_hdrops, "\t%llu packet%s shorter than header shows\n"); + p(etherips_qfull, "\t%llu packet%s were dropped due to full output queue\n"); + p(etherips_noifdrops, "\t%llu packet%s were dropped because of no interface/bridge information\n"); + p(etherips_pdrops, "\t%llu packet%s dropped due to policy\n"); + p(etherips_adrops, "\t%llu packet%s dropped for other reasons\n"); + p(etherips_ipackets, "\t%llu input ethernet-in-IP packet%s\n"); + p(etherips_opackets, "\t%llu output ethernet-in-IP packet%s\n"); + p(etherips_ibytes, "\t%llu input byte%s\n"); + p(etherips_obytes, "\t%llu output byte%s\n"); #undef p } |