From owner-freebsd-bugs Mon Aug 14 22: 0: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id CB94737B553 for ; Mon, 14 Aug 2000 22:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA62378; Mon, 14 Aug 2000 22:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from alcanet.com.au (mail.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with SMTP id E423837B52B for ; 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 Reply-To: peter.jeremy@alcatel.com.au To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/20611: VLAN parent device does not count VLAN output bytes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20611 >Category: kern >Synopsis: VLAN parent device does not count VLAN output bytes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 14 22:00:01 PDT 2000 >Closed-Date: >Last-Modified: >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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message