NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/49837: vlan(4) doesn't count up parent's obytes and omcasts counters



>Number:         49837
>Category:       kern
>Synopsis:       vlan(4) doesn't count up parent's obytes and omcasts counters
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 13 02:20:00 +0000 2015
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
>Environment:
NetBSD rangeley 7.99.5 NetBSD 7.99.5 (GENERIC) #116: Thu Feb 26 20:44:54 JST 2015  ozaki-r@rangeley:(hidden) amd64
>Description:
vlan (vlan_start) has a responsibility to count up parent's obytes and omcasts counters,
however, it doesn't.

BTW, opackets is correctly counted up, which is done in network device drivers.
Why don't we do such count-ups at a same place?
>How-To-Repeat:
ifconfig vlan0 create
ifconfig vlan0 vlan 10 vlanif wm0
ifconfig vlan0 10.0.1.2/24 up
ping -c 3 10.0.1.3 # ping to some other machine
ifconfig -v vlan0
ifconfig -v wm0 # compare vlan0's and wm0's counters
>Fix:
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 8fd01de..78fcf91 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -962,6 +962,10 @@ vlan_start(struct ifnet *ifp)
                }
 
                ifp->if_opackets++;
+
+               p->if_obytes += m->m_pkthdr.len;
+               if (m->m_flags & M_MCAST)
+                       p->if_omcasts++;
                if ((p->if_flags & (IFF_RUNNING|IFF_OACTIVE)) == IFF_RUNNING)
                        (*p->if_start)(p);
        }



Home | Main Index | Thread Index | Old Index