Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net l2tp(4): fix output bytes counter. Pointed by k-goda...



details:   https://anonhg.NetBSD.org/src/rev/49b84f7a450d
branches:  trunk
changeset: 446972:49b84f7a450d
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Dec 27 07:56:11 2018 +0000

description:
l2tp(4): fix output bytes counter. Pointed by k-goda@IIJ, thanks.

diffstat:

 sys/net/if_l2tp.c |  19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r cb8c850fe438 -r 49b84f7a450d sys/net/if_l2tp.c
--- a/sys/net/if_l2tp.c Thu Dec 27 07:22:31 2018 +0000
+++ b/sys/net/if_l2tp.c Thu Dec 27 07:56:11 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_l2tp.c,v 1.32 2018/12/22 14:28:56 maxv Exp $        */
+/*     $NetBSD: if_l2tp.c,v 1.33 2018/12/27 07:56:11 knakahara Exp $   */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.32 2018/12/22 14:28:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.33 2018/12/27 07:56:11 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -426,9 +426,12 @@
        }
 
        for (;;) {
+               int len;
+
                IFQ_DEQUEUE(&ifp->if_snd, m);
                if (m == NULL)
                        break;
+               len = m->m_pkthdr.len;
                m->m_flags &= ~(M_BCAST|M_MCAST);
                bpf_mtap(ifp, m, BPF_D_OUT);
                switch (var->lv_psrc->sa_family) {
@@ -452,13 +455,9 @@
                        ifp->if_oerrors++;
                else {
                        ifp->if_opackets++;
-                       /*
-                        * obytes is incremented at ether_output() or
-                        * bridge_enqueue().
-                        */
+                       ifp->if_obytes += len;
                }
        }
-
 }
 
 void
@@ -570,6 +569,7 @@
 l2tp_transmit(struct ifnet *ifp, struct mbuf *m)
 {
        int error;
+       int len;
        struct psref psref;
        struct l2tp_variant *var;
        struct l2tp_softc *sc = container_of(ifp, struct l2tp_softc,
@@ -587,6 +587,7 @@
                goto out;
        }
 
+       len = m->m_pkthdr.len;
        m->m_flags &= ~(M_BCAST|M_MCAST);
        bpf_mtap(ifp, m, BPF_D_OUT);
        switch (var->lv_psrc->sa_family) {
@@ -610,9 +611,7 @@
                ifp->if_oerrors++;
        else {
                ifp->if_opackets++;
-               /*
-                * obytes is incremented at ether_output() or bridge_enqueue().
-                */
+               ifp->if_obytes += len;
        }
 
 out:



Home | Main Index | Thread Index | Old Index