From jeremyp@gsmx07.alcatel.com.au  Mon Aug 14 21:51:29 2000
Return-Path: <jeremyp@gsmx07.alcatel.com.au>
Received: from alcanet.com.au (mail.alcanet.com.au [203.62.196.10])
	by hub.freebsd.org (Postfix) with SMTP id E423837B52B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Aug 2000 21:51:17 -0700 (PDT)
	(envelope-from jeremyp@gsmx07.alcatel.com.au)
Received: by border.alcanet.com.au id <115224>; Tue, 15 Aug 2000 14:51:10 +1000
Message-Id: <00Aug15.145110est.115224@border.alcanet.com.au>
Date: Tue, 15 Aug 2000 14:51:05 +1000 (EST)
From: peter.jeremy@alcatel.com.au
Sender: jeremyp@gsmx07.alcatel.com.au
Reply-To: peter.jeremy@alcatel.com.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: VLAN parent device does not count VLAN output bytes
X-Send-Pr-Version: 3.2

>Number:         20611
>Category:       kern
>Synopsis:       VLAN parent device does not count VLAN output bytes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 14 22:00:01 PDT 2000
>Closed-Date:    Wed May 30 05:45:15 PDT 2001
>Last-Modified:  Wed May 30 05:47:02 PDT 2001
>Originator:     Peter Jeremy
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Alcatel Australia Limited
>Environment:

	`current' -stable

>Description:

	Each network device includes counters for bytes and packets
	in and out.  For a physical interface associated with a VLAN
	interface, incoming and outgoing packets, as well as incoming
	bytes associated with the VLAN are counted, but outgoing bytes
	from the VLAN are not counted.  This is inconsistent.

	The problem is that output bytes are accumulated by
	ether_output_frame().  Packets sent to the VLAN go through
	this routine - which calls vlan_start() to process the
	packet.  vlan_start() directly calls the XX_start() routine
	associated with the physical interface.  vlan_start()
	replicates the relevant code within ether_output_frame(),
	but does not update the output byte count.  Likewise,
	the number of multicast frames sent via the VLAN are not
	counted.

	(There's also no support for bridging packets into an 802.1Q
	VLAN trunk.  Fixing this looks non-trivial, and I don't need
	this functionality, so I'll skip it).

>How-To-Repeat:

	Create (eg) vlan0 associated with (eg) fxp0 and pass traffic
	via vlan0 (with no traffic addressed directly to fxp0).  A
	netstat shows:

wansim# netstat -I fxp0 1
            input         (fxp0)           output
   packets  errs      bytes    packets  errs      bytes colls
       564     0      78690        586     0          0     0
       506     0      81024        521     0          0     0
       504     0      84068        519     0          0     0
       509     0     100559        530     0          0     0
       532     0      85011        557     0          0     0
^C

>Fix:

Index: if_vlan.c
===================================================================
RCS file: /gsmx07/CVSROOT/src/sys/net/if_vlan.c,v
retrieving revision 1.15.2.2
diff -u -r1.15.2.2 if_vlan.c
--- if_vlan.c	2000/07/17 21:24:34	1.15.2.2
+++ if_vlan.c	2000/08/15 04:47:01
@@ -268,6 +268,9 @@
 			m_freem(m);
 			continue;
 		}
+		p->if_obytes += m->m_pkthdr.len;
+		if (m->m_flags & M_MCAST)
+			p->if_omcasts++;
 		IF_ENQUEUE(&p->if_snd, m);
 		if ((p->if_flags & IFF_OACTIVE) == 0) {
 			p->if_start(p);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: yar 
State-Changed-When: Sat Mar 31 03:24:18 PST 2001 
State-Changed-Why:  
The bug has been fixed in -stable, and it no longer exists 
in -current due to some changes. Please check if the fix works. 


Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Sat Mar 31 03:24:18 PST 2001 
Responsible-Changed-Why:  
Over to the committer who deals with the problem (me) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20611 
State-Changed-From-To: feedback->closed 
State-Changed-By: yar 
State-Changed-When: Wed May 30 05:45:15 PDT 2001 
State-Changed-Why:  
The bug has been fixed. The originator hasn't provided 
feedback for two months. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=20611 
>Unformatted:
