diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2018-11-16 08:43:09 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2018-11-16 08:43:09 +0000 |
commit | 25fe2e90c7b9cc23f15984ce9da28a219dd7fbf4 (patch) | |
tree | 3910fc035d8802f3e9d4f83bc875018b4f07b8e5 /sys/net/if_vlan.c | |
parent | 3a66e96bcb0b016317efcc95b8c9a75aee82436a (diff) |
use txprio, not link0 and llprio, to set the dot1p field in the header.
if you're using llprio and link0, you'll need to update your config.
ok claudio@
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r-- | sys/net/if_vlan.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 8f279e22c5e..9a6b1d20909 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.178 2018/07/11 14:20:18 sf Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.179 2018/11/16 08:43:08 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -173,6 +173,7 @@ vlan_clone_create(struct if_clone *ifc, int unit) ifv->ifv_type = ETHERTYPE_VLAN; refcnt_init(&ifv->ifv_refcnt); + ifv->ifv_prio = IF_HDRPRIO_PACKET; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST; ifp->if_xflags = IFXF_CLONED|IFXF_MPSAFE; @@ -245,6 +246,7 @@ vlan_start(struct ifqueue *ifq) struct ifvlan *ifv; struct ifnet *ifp0; struct mbuf *m; + int txprio; uint8_t prio; ifv = ifp->if_softc; @@ -255,14 +257,16 @@ vlan_start(struct ifqueue *ifq) goto leave; } + txprio = ifv->ifv_prio; + while ((m = ifq_dequeue(ifq)) != NULL) { #if NBPFILTER > 0 if (ifp->if_bpf) bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ - prio = ISSET(ifp->if_flags, IFF_LINK0) ? - ifp->if_llprio : m->m_pkthdr.pf.prio; + prio = (txprio == IF_HDRPRIO_PACKET) ? + m->m_pkthdr.pf.prio : txprio; /* IEEE 802.1p has prio 0 and 1 swapped */ if (prio <= 1) @@ -714,6 +718,21 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = vlan_get_compat(ifp, ifr); break; + case SIOCSTXHPRIO: + if (ifr->ifr_hdrprio == IF_HDRPRIO_PACKET) + ; + else if (ifr->ifr_hdrprio > IF_HDRPRIO_MAX || + ifr->ifr_hdrprio < IF_HDRPRIO_MIN) { + error = EINVAL; + break; + } + + ifv->ifv_prio = ifr->ifr_hdrprio; + break; + case SIOCGTXHPRIO: + ifr->ifr_hdrprio = ifv->ifv_prio; + break; + default: error = ether_ioctl(ifp, &ifv->ifv_ac, cmd, data); break; |