diff options
author | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2011-11-26 23:38:19 +0000 |
---|---|---|
committer | Christiano F. Haesbaert <haesbaert@cvs.openbsd.org> | 2011-11-26 23:38:19 +0000 |
commit | 1416d0fcb10efdae5963d8244fb1f055c8fbfb6a (patch) | |
tree | 86bdc3e28566e12317b14f96c8a3724b01fd1b9f /sys/net | |
parent | ac64bde8bae57cee5646d0180c5064340b18bebb (diff) |
Tie the 802.1p (CoS) value in vlan(4) with the new prio scheme in pf.
When transmitting through vlan(4), it will now use the prio value in
pf packet header. When receiving, we save the incoming Cos in the same
place, this gives us the hability to preserve the CoS value across two
different vlan interfaces.
This kills the SIOC[GS]VLANPRIO ioctls and removes the corresponding
buttons from ifconfig(8).
ok henning@ claudio@ mcbride@
Diffstat (limited to 'sys/net')
-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 |