Date: Mon, 26 Dec 2011 19:25:29 -0800 From: YongHyeon PYUN <pyunyh@gmail.com> To: Joe Holden <lists@rewt.org.uk> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: bsnmpd not showing out octets for vlan interfaces Message-ID: <20111227032528.GA1844@michelle.cdnetworks.com> In-Reply-To: <4EF8D0A2.5010604@rewt.org.uk> References: <4EF8D0A2.5010604@rewt.org.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
--5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Dec 26, 2011 at 07:53:06PM +0000, Joe Holden wrote: > Hi guys, > > Hope you're all enjoying the holiday. > > Is anyone using bsnmpd with vlan interfaces? I see the following: > > ifOutOctets.10 = Counter32: 0 > ifOutOctets.11 = Counter32: 3061 > ifOutOctets.12 = Counter32: 0 > ifOutOctets.13 = Counter32: 0 > > The ones with 0 are vlan interfaces, everything else is fine - is this a > known issue or am I doing something wrong? Try attached patch and let me know how it goes. > > Thanks, > Joe --5mCyUwZo2JvN/JJP Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="vlan.diff" Index: sys/net/if_vlan.c =================================================================== --- sys/net/if_vlan.c (revision 228906) +++ sys/net/if_vlan.c (working copy) @@ -1012,10 +1012,12 @@ { struct ifvlan *ifv; struct ifnet *p; - int error; + int error, len, mcast; ifv = ifp->if_softc; p = PARENT(ifv); + len = m->m_pkthdr.len; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; BPF_MTAP(ifp, m); @@ -1025,7 +1027,7 @@ */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_collisions++; + ifp->if_oerrors++; return (0); } @@ -1081,9 +1083,11 @@ * Send it, precisely as ether_output() would have. */ error = (p->if_transmit)(p, m); - if (!error) + if (!error) { ifp->if_opackets++; - else + ifp->if_omcasts += mcast; + ifp->if_obytes += len; + } else ifp->if_oerrors++; return (error); } --5mCyUwZo2JvN/JJP--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111227032528.GA1844>