Date: Thu, 29 Dec 2011 17:32:59 -0800 From: YongHyeon PYUN <pyunyh@gmail.com> To: Joe Holden <lists@rewt.org.uk> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, John Baldwin <jhb@freebsd.org> Subject: Re: bsnmpd not showing out octets for vlan interfaces Message-ID: <20111230013259.GH10465@michelle.cdnetworks.com> In-Reply-To: <4EFD11C8.7090409@rewt.org.uk> References: <4EF8D0A2.5010604@rewt.org.uk> <20111227032528.GA1844@michelle.cdnetworks.com> <20111227040551.GH8035@FreeBSD.org> <201112291124.23626.jhb@freebsd.org> <4EFD11C8.7090409@rewt.org.uk>
index | next in thread | previous in thread | raw e-mail
On Fri, Dec 30, 2011 at 01:20:08AM +0000, Joe Holden wrote:
> John Baldwin wrote:
> >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.
> >
> I have been running with this patch for a couple of days now, counters
> appear to be working as expected
>
FYI: patch committed to HEAD(r228967).
> Thanks,
> Joe
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111230013259.GH10465>
