summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2017-01-22 10:17:37 +0000
committerdlg <dlg@openbsd.org>2017-01-22 10:17:37 +0000
commit88a08f2af426247cf5e32d11f8df17f5717812a1 (patch)
tree55b694cef98ba8f92034f91f4eed28aafa059f2a /sys/net
parentsync (diff)
downloadwireguard-openbsd-88a08f2af426247cf5e32d11f8df17f5717812a1.tar.xz
wireguard-openbsd-88a08f2af426247cf5e32d11f8df17f5717812a1.zip
move counting if_opackets next to counting if_obytes in if_enqueue.
this means packets are consistently counted in one place, unlike the many and various ways that drivers thought they should do it. ok mpi@ deraadt@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c3
-rw-r--r--sys/net/if_etherip.c4
-rw-r--r--sys/net/if_gif.c3
-rw-r--r--sys/net/if_pair.c3
-rw-r--r--sys/net/if_pppoe.c3
-rw-r--r--sys/net/if_trunk.c6
-rw-r--r--sys/net/if_tun.c4
-rw-r--r--sys/net/if_vether.c3
-rw-r--r--sys/net/if_vlan.c3
-rw-r--r--sys/net/if_vxlan.c4
10 files changed, 12 insertions, 24 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 20e9dcbc9de..642ae66c99a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.474 2017/01/12 09:07:46 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.475 2017/01/22 10:17:39 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -610,6 +610,7 @@ if_enqueue(struct ifnet *ifp, struct mbuf *m)
if (error)
return (error);
+ ifp->if_opackets++;
ifp->if_obytes += length;
if (mflags & M_MCAST)
ifp->if_omcasts++;
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index 91a027f181e..7ff8c76f726 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_etherip.c,v 1.10 2016/12/13 06:51:11 dlg Exp $ */
+/* $OpenBSD: if_etherip.c,v 1.11 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@@ -185,8 +185,6 @@ etherip_start(struct ifnet *ifp)
continue;
}
- ifp->if_opackets++;
-
switch (sc->sc_src.ss_family) {
case AF_INET:
error = ip_etherip_output(ifp, m);
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 75e82a8d0a3..97e5633b708 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.87 2016/12/13 06:51:11 dlg Exp $ */
+/* $OpenBSD: if_gif.c,v 1.88 2017/01/22 10:17:39 dlg Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -226,7 +226,6 @@ gif_start(struct ifnet *ifp)
m->m_pkthdr.len += offset;
}
#endif
- ifp->if_opackets++;
/* XXX we should cache the outgoing route */
diff --git a/sys/net/if_pair.c b/sys/net/if_pair.c
index 03e66f329ee..bae2ad4fb6e 100644
--- a/sys/net/if_pair.c
+++ b/sys/net/if_pair.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pair.c,v 1.8 2016/11/29 10:09:57 reyk Exp $ */
+/* $OpenBSD: if_pair.c,v 1.9 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -180,7 +180,6 @@ pairstart(struct ifnet *ifp)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif /* NBPFILTER > 0 */
- ifp->if_opackets++;
if (pairedifp != NULL) {
if (m->m_flags & M_PKTHDR)
m_resethdr(m);
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index b15fad205de..51a7b5746b4 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.59 2017/01/02 08:44:13 mpi Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.60 2017/01/22 10:17:39 dlg Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -778,7 +778,6 @@ pppoe_output(struct pppoe_softc *sc, struct mbuf *m)
/* encapsulated packet is forced into rdomain of physical interface */
m->m_pkthdr.ph_rtableid = eth_if->if_rdomain;
- sc->sc_sppp.pp_if.if_opackets++;
ret = eth_if->if_output(eth_if, m, &dst, NULL);
if_put(eth_if);
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index 84a80e1f554..1741ad01d48 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.128 2016/09/16 09:51:21 mikeb Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.129 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -934,9 +934,7 @@ trunk_start(struct ifnet *ifp)
if (tr->tr_proto != TRUNK_PROTO_NONE && tr->tr_count) {
error = (*tr->tr_start)(tr, m);
- if (error == 0)
- ifp->if_opackets++;
- else
+ if (error != 0)
ifp->if_oerrors++;
} else {
m_freem(m);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 9529a29e84f..d3876ab1b4a 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.171 2016/12/21 13:13:01 mikeb Exp $ */
+/* $OpenBSD: if_tun.c,v 1.172 2017/01/22 10:17:39 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -590,7 +590,6 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
ifp->if_collisions++;
return (error);
}
- ifp->if_opackets++;
tun_wakeup(tp);
return (0);
@@ -832,7 +831,6 @@ tun_dev_read(struct tun_softc *tp, struct uio *uio, int ioflag)
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
#endif
- ifp->if_opackets++;
}
while (m0 != NULL && uio->uio_resid > 0 && error == 0) {
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c
index 082c05615d6..77938e0b7c8 100644
--- a/sys/net/if_vether.c
+++ b/sys/net/if_vether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vether.c,v 1.28 2016/11/29 10:09:57 reyk Exp $ */
+/* $OpenBSD: if_vether.c,v 1.29 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt
@@ -133,7 +133,6 @@ vetherstart(struct ifnet *ifp)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif /* NBPFILTER > 0 */
- ifp->if_opackets++;
m_freem(m);
}
}
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 594c251b767..fcf7ed49ca6 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.167 2016/10/10 02:44:17 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.168 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -298,7 +298,6 @@ vlan_start(struct ifnet *ifp)
ifp->if_oerrors++;
continue;
}
- ifp->if_opackets++;
}
leave:
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index bab97040203..4d8620af63b 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.56 2017/01/04 12:49:49 mikeb Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.57 2017/01/22 10:17:39 dlg Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -310,8 +310,6 @@ vxlanstart(struct ifnet *ifp)
if (m == NULL)
return;
- ifp->if_opackets++;
-
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);