From: dlg Date: Wed, 27 May 2015 12:23:44 +0000 (+0000) Subject: check if the packet is for us or if we're promisc before we cut the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c0a68582ec672efb747df40de4e4bf923a689a94;p=openbsd check if the packet is for us or if we're promisc before we cut the vlan header out of the packet. fixes rx on top of trunks on top of nics that dont do hw vlan tagging. ok mpi@ --- diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 76f20fea76c..e3dd261e746 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.126 2015/05/26 11:39:07 mpi Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.127 2015/05/27 12:23:44 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -331,19 +331,6 @@ vlan_input(struct mbuf *m) return (1); } - /* - * Having found a valid vlan interface corresponding to - * the given source interface and vlan tag, remove the - * encapsulation. - */ - if (m->m_flags & M_VLANTAG) { - m->m_flags &= ~M_VLANTAG; - } else { - eh->ether_type = evl->evl_proto; - memmove((char *)eh + EVL_ENCAPLEN, eh, sizeof(*eh)); - m_adj(m, EVL_ENCAPLEN); - } - /* * Drop promiscuously received packets if we are not in * promiscuous mode. @@ -358,6 +345,19 @@ vlan_input(struct mbuf *m) } } + /* + * Having found a valid vlan interface corresponding to + * the given source interface and vlan tag, remove the + * encapsulation. + */ + if (m->m_flags & M_VLANTAG) { + m->m_flags &= ~M_VLANTAG; + } else { + eh->ether_type = evl->evl_proto; + memmove((char *)eh + EVL_ENCAPLEN, eh, sizeof(*eh)); + m_adj(m, EVL_ENCAPLEN); + } + ml_enqueue(&ml, m); if_input(&ifv->ifv_if, &ml); ifv->ifv_if.if_ipackets++;