Index: if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.207 diff -u -p -r1.207 if_vlan.c --- if_vlan.c 9 Jun 2021 03:24:54 -0000 1.207 +++ if_vlan.c 9 Jun 2021 03:34:56 -0000 @@ -336,6 +336,23 @@ leave: } struct mbuf * +vlan_strip(struct mbuf *m) +{ + if (ISSET(m->m_flags, M_VLANTAG)) { + CLR(m->m_flags, M_VLANTAG); + } else { + struct ether_vlan_header *evl; + + evl = mtod(m, struct ether_vlan_header *); + memmove((caddr_t)evl + EVL_ENCAPLEN, evl, + offsetof(struct ether_vlan_header, evl_encap_proto)); + m_adj(m, EVL_ENCAPLEN); + } + + return (m); +} + +struct mbuf * vlan_inject(struct mbuf *m, uint16_t type, uint16_t tag) { struct ether_vlan_header evh; @@ -407,8 +424,15 @@ vlan_input(struct ifnet *ifp0, struct mb } smr_read_leave(); - if (sc == NULL) - return (m); /* decline, let bridge have a go */ + if (sc == NULL) { + /* VLAN 0 Priority Tagging */ + if (tag == 0 && etype == ETHERTYPE_VLAN) { + /* XXX we should actually use the prio value */ + m = vlan_strip(m); + } + + return (m); /* decline */ + } ifp = &sc->sc_if; if (!ISSET(ifp->if_flags, IFF_RUNNING)) { @@ -421,13 +445,7 @@ vlan_input(struct ifnet *ifp0, struct mb * the given source interface and vlan tag, remove the * encapsulation. */ - if (ISSET(m->m_flags, M_VLANTAG)) { - CLR(m->m_flags, M_VLANTAG); - } else { - memmove((caddr_t)evl + EVL_ENCAPLEN, evl, - offsetof(struct ether_vlan_header, evl_encap_proto)); - m_adj(m, EVL_ENCAPLEN); - } + m = vlan_strip(m); rxprio = sc->sc_rxprio; switch (rxprio) {