From c75134bf5e5afb3bd52f9a911441588e6b26da2d Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Sat, 2 Dec 2000 14:46:35 +0000 Subject: vlan devices should not try to emit packets if the parent interface is not running and not up. From NetBSD: move if_opackets to that it's incremented even if the parent interface is oactive. --- sys/net/if_vlan.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 662d81f6fbd..02d01ecd8ed 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.6 2000/10/18 15:55:48 chris Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.7 2000/12/02 14:46:34 jason Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology * @@ -194,6 +194,16 @@ vlan_start(struct ifnet *ifp) IF_DEQUEUE(&ifp->if_snd, m); if (m == 0) break; + + if ((p->if_flags & (IFF_UP|IFF_RUNNING)) != + (IFF_UP|IFF_RUNNING)) { + IF_DROP(&p->if_snd); + /* XXX stats */ + ifp->if_oerrors++; + m_freem(m); + continue; + } + #if NBPFILTER > 0 if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m); @@ -267,10 +277,9 @@ vlan_start(struct ifnet *ifp) if (m->m_flags & M_MCAST) p->if_omcasts++; IF_ENQUEUE(&p->if_snd, m); - if ((p->if_flags & IFF_OACTIVE) == 0) { + ifp->if_opackets++; + if ((p->if_flags & IFF_OACTIVE) == 0) p->if_start(p); - ifp->if_opackets++; - } } ifp->if_flags &= ~IFF_OACTIVE; -- cgit v1.2.3