at the moment, vlan(4) takes the priority from mbufs and maps it
to the vlan priority field on the wire when sending packets out.
however, some isps now use pppoe on a vlan for connectivity, but
only accept vlan packets with a specific priority level set, usually
1 (which is 0 on the wire). to force pppoe to use priority 1, you
can ifconfig pppoe0 llprio 1. to force data packets to use prio 1,
you must use pf to do it. for non-ip packets, eg arp and dhcp packets
from bpfwrite, you need to set the vlan interface's llprio to 1.

there is a caveat to all this in that flattening the prio on mbufs
also makes priority queueing on interfaces impossible. because
everything get's mapped to prio 1, there's no way to make pppoe
control frames higher priority than data, and tcp syn packets higher
priority than data packets and so on.

i recently got moved to an isp like this, and i found having to
configure this knowledge in 2 different places for pppoe to work
was tedious and felt brittle. so because of that, and the loss of
priority queueing, i came up with the following diff. it makes
vlan(4) use it's llprio value for the value on the wire if link0
is set. if link0 is not set, the prio is taken from the mbuf like
now.

ok?

Index: if_vlan.c
===================================================================
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.176
diff -u -p -r1.176 if_vlan.c
--- if_vlan.c   19 Feb 2018 08:59:52 -0000      1.176
+++ if_vlan.c   25 Mar 2018 05:12:05 -0000
@@ -261,9 +261,10 @@ vlan_start(struct ifqueue *ifq)
                        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;
 
                /* IEEE 802.1p has prio 0 and 1 swapped */
-               prio = m->m_pkthdr.pf.prio;
                if (prio <= 1)
                        prio = !prio;
 

Reply via email to