diff options
author | 2019-04-27 05:58:17 +0000 | |
---|---|---|
committer | 2019-04-27 05:58:17 +0000 | |
commit | d69bee487ecbbadef3487a72d06358283f2a5f17 (patch) | |
tree | 4939f0145d8e7e0f95b351d5aec7f001a948e913 | |
parent | don't increment noproto on the parent interface when there's no child (diff) | |
download | wireguard-openbsd-d69bee487ecbbadef3487a72d06358283f2a5f17.tar.xz wireguard-openbsd-d69bee487ecbbadef3487a72d06358283f2a5f17.zip |
fix up some rxprio handling while here
we should swap the value off the wire for 802.1P, not the rxhprio
config value. try and avoid toctou issues by copying the sc_rxprio
value to a local.
-rw-r--r-- | sys/net/if_vlan.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index c81bce4c6a2..afae07f96dd 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.197 2019/04/27 05:55:27 dlg Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.198 2019/04/27 05:58:17 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -381,6 +381,7 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie) struct srp_ref sr; uint16_t tag; uint16_t etype; + int rxprio; eh = mtod(m, struct ether_header *); etype = ntohs(eh->ether_type); @@ -431,18 +432,19 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie) m_adj(m, EVL_ENCAPLEN); } - switch (sc->sc_rxprio) { + rxprio = sc->sc_rxprio; + switch (rxprio) { case IF_HDRPRIO_PACKET: break; case IF_HDRPRIO_OUTER: m->m_pkthdr.pf.prio = EVL_PRIOFTAG(m->m_pkthdr.ether_vtag); - break; - default: - m->m_pkthdr.pf.prio = sc->sc_rxprio; /* 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; break; + default: + m->m_pkthdr.pf.prio = rxprio; + break; } if_vinput(&sc->sc_if, m); |