From 58a6e92cd8c7ae437ee4eda514c74d1e26343498 Mon Sep 17 00:00:00 2001 From: damien Date: Mon, 4 Aug 2008 18:55:08 +0000 Subject: [PATCH] do not count ethernet header twice in if_obytes stats. do not count address family field twice in tun's if_obytes stats. ok henning@ reyk@ deraadt@ for the ethernet bits. ok deraadt@ for the tun bits. --- sys/net/if_ethersubr.c | 6 +++--- sys/net/if_tun.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 6dd11e54023..fb928093639 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.122 2008/06/13 23:24:21 mpf Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.123 2008/08/04 18:55:08 damien Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -460,10 +460,10 @@ ether_output(ifp0, m0, dst, rt0) splx(s); return (error); } - ifp->if_obytes += len + ETHER_HDR_LEN; + ifp->if_obytes += len; #if NCARP > 0 if (ifp != ifp0) - ifp0->if_obytes += len + ETHER_HDR_LEN; + ifp0->if_obytes += len; #endif /* NCARP > 0 */ if (mflags & M_MCAST) ifp->if_omcasts++; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 417c350a13f..bd20a295b48 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.93 2008/05/07 05:51:12 mpf Exp $ */ +/* $OpenBSD: if_tun.c,v 1.94 2008/08/04 18:55:08 damien Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -561,7 +561,7 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif - len = m0->m_pkthdr.len + sizeof(*af); + len = m0->m_pkthdr.len; s = splnet(); IFQ_ENQUEUE(&ifp->if_snd, m0, NULL, error); if (error) { -- 2.20.1