NetBSD Problem Report #49837

From www@NetBSD.org  Mon Apr 13 02:17:43 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C137DA6567
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 13 Apr 2015 02:17:43 +0000 (UTC)
Message-Id: <20150413021742.B2D06A65B0@mollari.NetBSD.org>
Date: Mon, 13 Apr 2015 02:17:42 +0000 (UTC)
From: ozaki-r@netbsd.org
Reply-To: ozaki-r@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: vlan(4) doesn't count up parent's obytes and omcasts counters
X-Send-Pr-Version: www-1.0

>Number:         49837
>Category:       kern
>Synopsis:       vlan(4) doesn't count up parent's obytes and omcasts counters
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 13 02:20:00 +0000 2015
>Closed-Date:    Thu Jul 30 16:16:14 +0000 2015
>Last-Modified:  Thu Jul 30 16:16:14 +0000 2015
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
>Environment:
NetBSD rangeley 7.99.5 NetBSD 7.99.5 (GENERIC) #116: Thu Feb 26 20:44:54 JST 2015  ozaki-r@rangeley:(hidden) amd64
>Description:
vlan (vlan_start) has a responsibility to count up parent's obytes and omcasts counters,
however, it doesn't.

BTW, opackets is correctly counted up, which is done in network device drivers.
Why don't we do such count-ups at a same place?
>How-To-Repeat:
ifconfig vlan0 create
ifconfig vlan0 vlan 10 vlanif wm0
ifconfig vlan0 10.0.1.2/24 up
ping -c 3 10.0.1.3 # ping to some other machine
ifconfig -v vlan0
ifconfig -v wm0 # compare vlan0's and wm0's counters
>Fix:
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 8fd01de..78fcf91 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -962,6 +962,10 @@ vlan_start(struct ifnet *ifp)
                }

                ifp->if_opackets++;
+
+               p->if_obytes += m->m_pkthdr.len;
+               if (m->m_flags & M_MCAST)
+                       p->if_omcasts++;
                if ((p->if_flags & (IFF_RUNNING|IFF_OACTIVE)) == IFF_RUNNING)
                        (*p->if_start)(p);
        }

>Release-Note:

>Audit-Trail:
From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49837 CVS commit: src/sys/net
Date: Sat, 18 Apr 2015 18:32:16 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Sat Apr 18 18:32:16 UTC 2015

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

 Log Message:
 Count up parent's obytes and omcasts counters

 PR kern/49837


 To generate a diff of this commit:
 cvs rdiff -u -r1.80 -r1.81 src/sys/net/if_vlan.c

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

State-Changed-From-To: open->pending-pullups
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Sun, 19 Apr 2015 10:39:50 +0000
State-Changed-Why:
Need pullup-7 and pullup-6.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49837 CVS commit: [netbsd-7] src/sys/net
Date: Thu, 23 Apr 2015 19:23:45 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Thu Apr 23 19:23:45 UTC 2015

 Modified Files:
 	src/sys/net [netbsd-7]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #710):
 	sys/net/if_vlan.c: revision 1.81
 Count up parent's obytes and omcasts counters
 PR kern/49837


 To generate a diff of this commit:
 cvs rdiff -u -r1.70.2.2 -r1.70.2.3 src/sys/net/if_vlan.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49837 CVS commit: [netbsd-6] src/sys/net
Date: Fri, 24 Apr 2015 05:56:43 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Fri Apr 24 05:56:42 UTC 2015

 Modified Files:
 	src/sys/net [netbsd-6]: if_vlan.c

 Log Message:
 Pull up following revision(s) (requested by ozaki-r in ticket #1295):
 	sys/net/if_vlan.c: revision 1.81
 Count up parent's obytes and omcasts counters
 PR kern/49837


 To generate a diff of this commit:
 cvs rdiff -u -r1.69.8.3 -r1.69.8.4 src/sys/net/if_vlan.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Thu, 30 Jul 2015 16:16:14 +0000
State-Changed-Why:
Pulled up.  Thanks!


>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.