summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-06-29 10:32:30 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-06-29 10:32:30 +0000
commit0cda890c55e557559455e589a0c81132442f9065 (patch)
tree291e12f4f3795593472e9ddcf9746b903a482130 /sys/net
parent9dd908757580b8c39e3376d93e990f411b793dd9 (diff)
count if_ibytes in if_input like we do for if_ipackets.
tweaks and ok mpi@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c9
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_trunk.c4
-rw-r--r--sys/net/if_vlan.c4
4 files changed, 9 insertions, 12 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index a4a480bbb75..63af716aa7e 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.345 2015/06/25 09:20:20 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.346 2015/06/29 10:32:29 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -494,16 +494,19 @@ void
if_input(struct ifnet *ifp, struct mbuf_list *ml)
{
struct mbuf *m;
+ size_t ibytes = 0;
splassert(IPL_NET);
- ifp->if_ipackets += ml_len(ml);
-
MBUF_LIST_FOREACH(ml, m) {
m->m_pkthdr.ph_ifidx = ifp->if_index;
m->m_pkthdr.ph_rtableid = ifp->if_rdomain;
+ ibytes += m->m_pkthdr.len;
}
+ ifp->if_ipackets += ml_len(ml);
+ ifp->if_ibytes += ibytes;
+
#if NBPFILTER > 0
if (ifp->if_bpf) {
KERNEL_LOCK();
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 7b617832af4..5cbd6a62255 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.210 2015/06/25 09:22:36 mpi Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.211 2015/06/29 10:32:29 dlg Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -320,8 +320,6 @@ ether_input(struct mbuf *m)
ifp->if_imcasts++;
}
- ifp->if_ibytes += m->m_pkthdr.len + sizeof(*eh);
-
etype = ntohs(eh->ether_type);
ac = (struct arpcom *)ifp;
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index ebd3211d57b..8b66134e599 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.104 2015/06/24 09:40:54 mpi Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.105 2015/06/29 10:32:29 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1101,8 +1101,6 @@ trunk_input(struct mbuf *m)
if (ETHER_IS_MULTICAST(eh->ether_dhost))
ifp->if_imcasts++;
- ifp->if_ibytes += m->m_pkthdr.len;
-
/* Should be checked by the caller */
if (ifp->if_type != IFT_IEEE8023ADLAG) {
error = EPROTONOSUPPORT;
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 1ed43aff7ca..3f039686af6 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.131 2015/06/24 09:40:54 mpi Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.132 2015/06/29 10:32:29 dlg Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -282,8 +282,6 @@ vlan_input(struct mbuf *m)
return (0);
}
- ifp->if_ibytes += m->m_pkthdr.len;
-
/* From now on ether_vtag is fine */
tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag);
m->m_pkthdr.pf.prio = EVL_PRIOFTAG(m->m_pkthdr.ether_vtag);