From yar@yar.chem.msu.su  Sat Oct 21 03:36:32 2000
Return-Path: <yar@yar.chem.msu.su>
Received: from yar.chem.msu.su (yar.chem.msu.ru [195.208.208.25])
	by hub.freebsd.org (Postfix) with ESMTP id 8A8C337B4C5
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Oct 2000 03:36:29 -0700 (PDT)
Received: (from yar@localhost)
	by yar.chem.msu.su (8.11.0/8.11.0) id e9LAaKB00424;
	Sat, 21 Oct 2000 14:36:20 +0400 (MSD)
	(envelope-from yar)
Message-Id: <200010211036.e9LAaKB00424@yar.chem.msu.su>
Date: Sat, 21 Oct 2000 14:36:20 +0400 (MSD)
From: yar@comp.chem.msu.su
Sender: yar@yar.chem.msu.su
Reply-To: yar@comp.chem.msu.su
To: FreeBSD-gnats-submit@freebsd.org
Subject: Output byte counter on VLAN parent not advancing
X-Send-Pr-Version: 3.2

>Number:         22178
>Category:       kern
>Synopsis:       Output byte counter on VLAN parent not advancing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 21 03:40:01 PDT 2000
>Closed-Date:    Sat Mar 31 03:08:16 PST 2001
>Last-Modified:  Sat Mar 31 03:10:25 PST 2001
>Originator:     Yar Tikhiy
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Moscow State University
>Environment:

	The bug shows up in all branches.

>Description:

	While the output packet counter on an ethernet interface
	is incremented by its hardware driver, the output byte and
	output multicast counters are advanced by ether_output().

	However, when an ethernet interface acts as a parent for a set
	of VLAN interfaces, ether_output() is bypassed for it. Therefore,
	it's a duty of vlan_start() to update the counters.

	Additionally, the output packet counter of the vlan interface
	itself is advanced at a wrong place: even if p->if_start()
	isn't called due to the IFF_OACTIVE flag, the packet
	has already been enqueued for transmission and will be sent
	out.

>How-To-Repeat:

	Use the vlan driver and see zero output byte counter on its
	parent interface with "netstat -i"

>Fix:

--- if_vlan.c.orig	Sat Oct 21 14:13:01 2000
+++ if_vlan.c	Sat Oct 21 14:21:58 2000
@@ -269,10 +269,12 @@
 			continue;
 		}
 		IF_ENQUEUE(&p->if_snd, m);
-		if ((p->if_flags & IFF_OACTIVE) == 0) {
+		ifp->if_opackets++;
+		p->if_obytes += m->m_pkthdr.len;
+		if (m->m_flags & M_MCAST)
+			p->if_omcasts++;
+		if ((p->if_flags & IFF_OACTIVE) == 0)
 			p->if_start(p);
-			ifp->if_opackets++;
-		}
 	}
 	ifp->if_flags &= ~IFF_OACTIVE;
 

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: yar 
State-Changed-When: Tue Mar 27 05:45:49 PST 2001 
State-Changed-Why:  
After introducing IF_HOLDOFF, the bug ceased to exist in -current. 
However, -stable still needs to be fixed. 


Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Tue Mar 27 05:45:49 PST 2001 
Responsible-Changed-Why:  
It's me who deals with the problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22178 
State-Changed-From-To: analyzed->closed 
State-Changed-By: yar 
State-Changed-When: Sat Mar 31 03:08:16 PST 2001 
State-Changed-Why:  
Fixed in 4-stable, ceased to exist in 5-current after 
IF_HANDOFF() had been introduced. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22178 
>Unformatted:
