NetBSD-Bugs archive

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

kern/42285: if_stf doesn't count output bytes



>Number:         42285
>Category:       kern
>Synopsis:       if_stf doesn't count output bytes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 08 17:45:00 +0000 2009
>Originator:     Daniel Hagerty
>Release:        NetBSD 4.0.1_PATCH
>Organization:
        
>Environment:
        
        
System: NetBSD perdition.linnaean.org 4.0.1_PATCH NetBSD 4.0.1_PATCH 
(PERDITION) #5: Wed Jul 8 18:39:19 EDT 2009 
hag%yall.linnaean.org@localhost:/usr/src/sys/arch/i386/compile/PERDITION i386
Architecture: i386
Machine: i386
>Description:
(It's possible I reported this before, but I can't find any record of
the PR.)

The netbsd 6to4 interface does not count output bytes.  I've observed
this on 4.0_PATCH, but the bug still seems to be present in the cvs
head.

>How-To-Repeat:
Setup a 6to4 interface; observe how netstat -bnI stf0 will
never show obytes greater than zero despite usage.

>Fix:
Apply attached patch (this was against netbsd-4).

The obytes agree with the existing ibytes accounting.  I'm not sure
that the ibytes accounting as found is actually correct -- physical
ethernet devices include the ethernet header bytes as part of their
accounting, but stf is not counting the outer IP encapsulation in its.
This seems incongruous.

Index: if_stf.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_stf.c,v
retrieving revision 1.54
diff -u -r1.54 if_stf.c
--- if_stf.c    16 Nov 2006 01:33:40 -0000      1.54
+++ if_stf.c    8 Nov 2009 17:22:58 -0000
@@ -439,6 +439,7 @@
        }
 
        ifp->if_opackets++;
+       ifp->if_obytes += m->m_pkthdr.len - sizeof(struct ip);
        return ip_output(m, NULL, &sc->sc_ro, 0,
            (struct ip_moptions *)NULL, (struct socket *)NULL);
 }

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index