From owner-freebsd-net@FreeBSD.ORG Thu Dec 29 16:24:27 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 9E37B106564A; Thu, 29 Dec 2011 16:24:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 737168FC1A; Thu, 29 Dec 2011 16:24:27 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 2B29A46B46; Thu, 29 Dec 2011 11:24:27 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 79E5BB974; Thu, 29 Dec 2011 11:24:26 -0500 (EST) From: John Baldwin To: Gleb Smirnoff Date: Thu, 29 Dec 2011 11:24:23 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <4EF8D0A2.5010604@rewt.org.uk> <20111227032528.GA1844@michelle.cdnetworks.com> <20111227040551.GH8035@FreeBSD.org> In-Reply-To: <20111227040551.GH8035@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201112291124.23626.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 29 Dec 2011 11:24:26 -0500 (EST) Cc: YongHyeon PYUN , "freebsd-net@freebsd.org" , Joe Holden 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: Thu, 29 Dec 2011 16:24:27 -0000 On Monday, December 26, 2011 11:05:51 pm Gleb Smirnoff wrote: > 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. I didn't really change it, I just unindented it when the loop was removed during the transition to if_transmit. :) However, this patch looks good to me. -- John Baldwin