summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorChristiano F. Haesbaert <haesbaert@cvs.openbsd.org>2011-11-26 23:38:19 +0000
committerChristiano F. Haesbaert <haesbaert@cvs.openbsd.org>2011-11-26 23:38:19 +0000
commit1416d0fcb10efdae5963d8244fb1f055c8fbfb6a (patch)
tree86bdc3e28566e12317b14f96c8a3724b01fd1b9f /sys
parentac64bde8bae57cee5646d0180c5064340b18bebb (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')
-rw-r--r--sys/net/if_vlan.c35
-rw-r--r--sys/sys/sockio.h5
2 files changed, 9 insertions, 31 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
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
index 198b7a6c81d..3b512b373b7 100644
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sockio.h,v 1.48 2010/07/03 04:44:51 guenther Exp $ */
+/* $OpenBSD: sockio.h,v 1.49 2011/11/26 23:38:18 haesbaert Exp $ */
/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */
/*-
@@ -161,8 +161,7 @@
#define SIOCSIFTIMESLOT _IOW('i', 133, struct ifreq) /* set ifnet timeslot */
#define SIOCGIFTIMESLOT _IOWR('i', 134, struct ifreq) /* get ifnet timeslot */
-#define SIOCSETVLANPRIO _IOW('i', 143, struct ifreq) /* set VLAN priority */
-#define SIOCGETVLANPRIO _IOWR('i', 144, struct ifreq) /* get VLAN priority */
+/* 143 and 144 (SIOC[GS]VLANPRIO) were removed, do not reuse it before 5.1 */
#define SIOCSETLABEL _IOW('i', 153, struct ifreq) /* set MPLS label */
#define SIOCGETLABEL _IOW('i', 154, struct ifreq) /* get MPLS label */