Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Fix vlan(4) obytes counter. Implemented by s-yamaguc...
details: https://anonhg.NetBSD.org/src/rev/0714e29485f2
branches: trunk
changeset: 825971:0714e29485f2
user: knakahara <knakahara%NetBSD.org@localhost>
date: Wed Aug 09 06:17:23 2017 +0000
description:
Fix vlan(4) obytes counter. Implemented by s-yamaguchi@IIJ, thanks.
diffstat:
sys/net/if_vlan.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r 685edfb0fb85 -r 0714e29485f2 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Wed Aug 09 06:04:41 2017 +0000
+++ b/sys/net/if_vlan.c Wed Aug 09 06:17:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.98 2017/06/07 03:53:11 knakahara Exp $ */
+/* $NetBSD: if_vlan.c,v 1.99 2017/08/09 06:17:23 knakahara 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.98 2017/06/07 03:53:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.99 2017/08/09 06:17:23 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1342,6 +1342,8 @@
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 @@
/* 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:
Home |
Main Index |
Thread Index |
Old Index