NetBSD Problem Report #42285

From hag@linnaean.org  Sun Nov  8 17:42:18 2009
Return-Path: <hag@linnaean.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 294E963B8CD
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Nov 2009 17:42:18 +0000 (UTC)
Message-Id: <20091108174214.40306A868@perdition.linnaean.org>
Date: Sun,  8 Nov 2009 12:42:14 -0500 (EST)
From: hag@linnaean.org
Reply-To: Daniel Hagerty <hag@linnaean.org>
To: gnats-bugs@gnats.NetBSD.org
Subject: if_stf doesn't count output bytes
X-Send-Pr-Version: 3.95

>Number:         42285
>Category:       kern
>Synopsis:       if_stf doesn't count output bytes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 08 17:45:00 +0000 2009
>Closed-Date:    Sun Nov 08 18:16:09 +0000 2009
>Last-Modified:  Sun Nov 08 18:45:04 +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:/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);
 }

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 08 Nov 2009 18:16:09 +0000
State-Changed-Why:
You did report this before, in PR 41559.  I'm closing this one as a duplicate.


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42285 CVS commit: src/sys/net
Date: Sun, 8 Nov 2009 13:44:46 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Nov  8 18:44:46 UTC 2009

 Modified Files:
 	src/sys/net: if_stf.c

 Log Message:
 PR/42285: PR/41559: Daniel Hagerty: if_stf doesn't count output bytes


 To generate a diff of this commit:
 cvs rdiff -u -r1.72 -r1.73 src/sys/net/if_stf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.