summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2015-02-06 08:07:10 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2015-02-06 08:07:10 +0000
commitdad025b572ca97b7fa36aca36d0f559016a92a40 (patch)
tree97c3a07bd980fb1de5eed6fcd65d19c9c1df1673 /sys/net
parent8bdc4cbb7bd92dd988abb444b6ab0b017e3dedd4 (diff)
IEEE sez that 0 is bigger than 1, and IEEE is always right.
When mapping 802.1p prio from the vlan header to our priority levels, we have to swap 0 and 1, since in 802.1p, 1 is the lowest prio, and 0 the 2nd lowest. But 2..7 are in the expected order! Pointed out to me at BSDcan and I forgot by whom, sorry for that and the delay. ok phessler pelikan
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_vlan.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 5b04560b007..25fe1c84606 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.111 2014/12/19 17:14:40 tedu Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.112 2015/02/06 08:07:09 henning Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -296,6 +296,10 @@ vlan_input(struct ether_header *eh, struct mbuf *m)
tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag);
m->m_pkthdr.pf.prio = EVL_PRIOFTAG(m->m_pkthdr.ether_vtag);
+ /* IEEE 802.1p has prio 0 and 1 swapped */
+ if (m->m_pkthdr.pf.prio <= 1)
+ m->m_pkthdr.pf.prio = !m->m_pkthdr.pf.prio;
+
LIST_FOREACH(ifv, &tagh[TAG_HASH(tag)], ifv_list) {
if (m->m_pkthdr.rcvif == ifv->ifv_p && tag == ifv->ifv_tag &&
etype == ifv->ifv_type)