From fc07e4027a813e9a692e138b5205b4ef17d02f72 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Sat, 11 Feb 2006 20:25:00 +0000 Subject: [PATCH] Don't count output bytes twice (the byte accouting is done in if.c). Count output errors. MFC after: 3 days --- sys/netgraph/ng_eiface.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 3ecda10c08ed..1e0f0b3a7d31 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -208,7 +208,7 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) { struct ifnet *ifp = arg1; const priv_p priv = (priv_p)ifp->if_softc; - int len, error = 0; + int error = 0; struct mbuf *m; /* Check interface flags */ @@ -234,9 +234,6 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) */ BPF_MTAP(ifp, m); - /* Copy length before the mbuf gets invalidated */ - len = m->m_pkthdr.len; - /* * Send packet; if hook is not connected, mbuf will get * freed. @@ -244,10 +241,10 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) NG_SEND_DATA_ONLY(error, priv->ether, m); /* Update stats */ - if (error == 0) { - ifp->if_obytes += len; + if (error == 0) ifp->if_opackets++; - } + else + ifp->if_oerrors++; } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;