From owner-freebsd-net@FreeBSD.ORG Tue Dec 27 04:05:53 2011 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBFAE106564A; Tue, 27 Dec 2011 04:05:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 3E3538FC12; Tue, 27 Dec 2011 04:05:53 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pBR45q4l024855; Tue, 27 Dec 2011 08:05:52 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pBR45p64024854; Tue, 27 Dec 2011 08:05:51 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 27 Dec 2011 08:05:51 +0400 From: Gleb Smirnoff To: YongHyeon PYUN Message-ID: <20111227040551.GH8035@FreeBSD.org> References: <4EF8D0A2.5010604@rewt.org.uk> <20111227032528.GA1844@michelle.cdnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20111227032528.GA1844@michelle.cdnetworks.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "freebsd-net@freebsd.org" , Joe Holden , jhb@FreeBSD.org Subject: Re: bsnmpd not showing out octets for vlan interfaces X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2011 04:05:53 -0000 On Mon, Dec 26, 2011 at 07:25:29PM -0800, YongHyeon PYUN wrote: Y> Index: sys/net/if_vlan.c Y> =================================================================== Y> --- sys/net/if_vlan.c (revision 228906) Y> +++ sys/net/if_vlan.c (working copy) Y> @@ -1012,10 +1012,12 @@ Y> { Y> struct ifvlan *ifv; Y> struct ifnet *p; Y> - int error; Y> + int error, len, mcast; Y> Y> ifv = ifp->if_softc; Y> p = PARENT(ifv); Y> + len = m->m_pkthdr.len; Y> + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; Y> Y> BPF_MTAP(ifp, m); Y> Y> @@ -1025,7 +1027,7 @@ Y> */ Y> if (!UP_AND_RUNNING(p)) { Y> m_freem(m); Y> - ifp->if_collisions++; Y> + ifp->if_oerrors++; Y> return (0); Y> } Y> Y> @@ -1081,9 +1083,11 @@ Y> * Send it, precisely as ether_output() would have. Y> */ Y> error = (p->if_transmit)(p, m); Y> - if (!error) Y> + if (!error) { Y> ifp->if_opackets++; Y> - else Y> + ifp->if_omcasts += mcast; Y> + ifp->if_obytes += len; Y> + } else Y> ifp->if_oerrors++; Y> return (error); Y> } Thanks, Pyun! You can count me in as reviewer. I have also added jhb@ to Cc, the author of changed code, so that he can review, too. -- Totus tuus, Glebius.