From owner-freebsd-net@FreeBSD.ORG Tue Dec 27 03:27:26 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 B1B7D1065675 for ; Tue, 27 Dec 2011 03:27:26 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7476D8FC12 for ; Tue, 27 Dec 2011 03:27:26 +0000 (UTC) Received: by iadj38 with SMTP id j38so23717315iad.13 for ; Mon, 26 Dec 2011 19:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=YMxhwSkJJ+QHOiCBdeBHtGWfVbepqnhu/fyodrN5SS4=; b=hkgwxuVnySWO+rMyNUKLmnl821r9ufvGH0fOEYdVuZLACrhGC5wzixuo4wsgtJq8Tl v69RP5OqNhTEcQkxKQ2/D5TVW8oeUZHiggK7yHJ6gFPgFKFwXEEXIfW4D+sstINgWUHs ZoQ15NWLO+kK3kVA4ErWoHYV5l4BmY5GqJa7A= Received: by 10.42.180.9 with SMTP id bs9mr27200005icb.0.1324956445738; Mon, 26 Dec 2011 19:27:25 -0800 (PST) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id 36sm84851582ibc.6.2011.12.26.19.27.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Dec 2011 19:27:25 -0800 (PST) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Mon, 26 Dec 2011 19:25:29 -0800 From: YongHyeon PYUN Date: Mon, 26 Dec 2011 19:25:29 -0800 To: Joe Holden Message-ID: <20111227032528.GA1844@michelle.cdnetworks.com> References: <4EF8D0A2.5010604@rewt.org.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <4EF8D0A2.5010604@rewt.org.uk> User-Agent: Mutt/1.4.2.3i Cc: "freebsd-net@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 Reply-To: pyunyh@gmail.com 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 03:27:26 -0000 --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--