Module Name: src
Committed By: snj
Date: Mon Aug 14 23:39:24 UTC 2017
Modified Files:
src/sys/net [netbsd-8]: if_vlan.c
Log Message:
Pull up following revision(s) (requested by knakahara in ticket #205):
sys/net/if_vlan.c: revision 1.99
Fix vlan(4) obytes counter. Implemented by s-yamaguchi@IIJ, thanks.
To generate a diff of this commit:
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/net/if_vlan.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.97.2.1 src/sys/net/if_vlan.c:1.97.2.2
--- src/sys/net/if_vlan.c:1.97.2.1 Wed Jun 21 17:39:24 2017
+++ src/sys/net/if_vlan.c Mon Aug 14 23:39:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.97.2.1 2017/06/21 17:39:24 snj Exp $ */
+/* $NetBSD: if_vlan.c,v 1.97.2.2 2017/08/14 23:39:24 snj Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.1 2017/06/21 17:39:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.2 2017/08/14 23:39:24 snj Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1342,6 +1342,8 @@ vlan_transmit(struct ifnet *ifp, struct
struct ifvlan_linkmib *mib;
struct psref psref;
int error;
+ size_t pktlen = m->m_pkthdr.len;
+ bool mcast = (m->m_flags & M_MCAST) != 0;
mib = vlan_getref_linkmib(ifv, &psref);
if (mib == NULL) {
@@ -1451,10 +1453,11 @@ vlan_transmit(struct ifnet *ifp, struct
/* mbuf is already freed */
ifp->if_oerrors++;
} else {
+
ifp->if_opackets++;
- /*
- * obytes is incremented at ether_output() or bridge_enqueue().
- */
+ ifp->if_obytes += pktlen;
+ if (mcast)
+ ifp->if_omcasts++;
}
out: