diff options
Diffstat (limited to 'sys/net/if_vlan.c')
| -rw-r--r-- | sys/net/if_vlan.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index ddf8dfe5b1a..c4143ccc157 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.89 2011/09/18 11:17:57 miod Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.90 2011/11/26 23:38:18 haesbaert Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -226,7 +226,7 @@ vlan_start(struct ifnet *ifp) if ((p->if_capabilities & IFCAP_VLAN_HWTAGGING) && (ifv->ifv_type == ETHERTYPE_VLAN)) { m->m_pkthdr.ether_vtag = ifv->ifv_tag + - (ifv->ifv_prio << EVL_PRIO_BITS); + (m->m_pkthdr.pf.prio << EVL_PRIO_BITS); m->m_flags |= M_VLANTAG; } else { struct ether_vlan_header evh; @@ -235,7 +235,7 @@ vlan_start(struct ifnet *ifp) evh.evl_proto = evh.evl_encap_proto; evh.evl_encap_proto = htons(ifv->ifv_type); evh.evl_tag = htons(ifv->ifv_tag + - (ifv->ifv_prio << EVL_PRIO_BITS)); + (m->m_pkthdr.pf.prio << EVL_PRIO_BITS)); m_adj(m, ETHER_HDR_LEN); M_PREPEND(m, sizeof(evh), M_DONTWAIT); @@ -284,7 +284,6 @@ vlan_input(struct ether_header *eh, struct mbuf *m) if (m->m_flags & M_VLANTAG) { etype = ETHERTYPE_VLAN; tagh = vlan_tagh; - tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); } else { if (m->m_len < EVL_ENCAPLEN && (m = m_pullup(m, EVL_ENCAPLEN)) == NULL) { @@ -294,8 +293,11 @@ vlan_input(struct ether_header *eh, struct mbuf *m) etype = ntohs(eh->ether_type); tagh = etype == ETHERTYPE_QINQ ? svlan_tagh : vlan_tagh; - tag = EVL_VLANOFTAG(ntohs(*mtod(m, u_int16_t *))); + m->m_pkthdr.ether_vtag = ntohs(*mtod(m, u_int16_t *)); } + /* From now on ether_vtag is fine */ + tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); + m->m_pkthdr.pf.prio = EVL_PRIOFTAG(m->m_pkthdr.ether_vtag); LIST_FOREACH(ifv, &tagh[TAG_HASH(tag)], ifv_list) { if (m->m_pkthdr.rcvif == ifv->ifv_p && tag == ifv->ifv_tag && @@ -665,29 +667,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } error = copyout(&vlr, ifr->ifr_data, sizeof vlr); break; - case SIOCSETVLANPRIO: - if ((error = suser(p, 0)) != 0) - break; - if ((error = copyin(ifr->ifr_data, &vlr, sizeof vlr))) - break; - /* - * Don't let the caller set up a VLAN priority - * outside the range 0-7 - */ - if (vlr.vlr_tag > EVL_PRIO_MAX) { - error = EINVAL; - break; - } - ifv->ifv_prio = vlr.vlr_tag; - break; - case SIOCGETVLANPRIO: - bzero(&vlr, sizeof vlr); - if (ifv->ifv_p) - strlcpy(vlr.vlr_parent, ifv->ifv_p->if_xname, - sizeof(vlr.vlr_parent)); - vlr.vlr_tag = ifv->ifv_prio; - error = copyout(&vlr, ifr->ifr_data, sizeof vlr); - break; case SIOCSIFFLAGS: /* * For promiscuous mode, we enable promiscuous mode on |
