Hi!

I'll look into the problems(vlan interface with 0 tag and issues
priority differeces) you mentioned. I tested your idea of having vlan
interface without tag and IP on top of physical interface, but IP
traffic doesn't get picked up by parent.

Extreme(Brocade) SLX does it. Depending on the ingress port
configuration packets on egress can be with or without dot1q header.
Seems, it doesn't cause issues with other operating systems.

Rivo

On Fri, 2018-10-12 at 13:38 +1000, David Gwynne wrote:
> Hi Rivo,
> 
> vlan(4) can be configured to receive (and send) packets with 0 as the
> tag on the wire, which this diff will break.
> 
> I'm pretty confident you can leave an IP configured on the physical
> network interface, and create and configure a vlan interface on it
> without setting a VLAN id. The untagged frames should be received as
> normal on the parent, and the tagged frames with the priority will
> come in on the vlan interface but still get accepted for IP on the
> parent.
> 
> Note that the default priority of packets in the OpenBSD kernel is 3,
> which might be higher than what you expect an untagged packets
> priority to be. The default 802.1q priority is 1 iirc.
> 
> I'm curious as to where you see both tagged and untagged frames at
> the same time.
> 
> dlg
> 
> > On 11 Oct 2018, at 7:20 pm, Rivo Nurges <rivo.nur...@smit.ee>
> > wrote:
> > 
> > Hi!
> > 
> > In theory 802.1q header with vlan tag 0 can be used to just signal
> > priority. Now I'm seeing this in the wild. On a untagged port some
> > packets are coming with dotq header and some without. Currently we
> > drop
> > all the packets with dotq header and vlan tag 0.
> > 
> > Following patch fixes this by recording the priority and removing
> > the
> > header, so existing code to handle the packet. At least NetBSD does
> > something similar.
> > 
> > Rivo
> > 
> > diff --git sys/net/if_ethersubr.c sys/net/if_ethersubr.c
> > index 76f6c3147e0..68f5b03b4f4 100644
> > --- sys/net/if_ethersubr.c
> > +++ sys/net/if_ethersubr.c
> > @@ -362,6 +362,22 @@ ether_input(struct ifnet *ifp, struct mbuf *m,
> > void *cookie)
> > 
> >     etype = ntohs(eh->ether_type);
> > 
> > +   /*
> > +    * 802.1Q header with a tag of 0 can be used to store priority.
> > +    */
> > +   if (etype == ETHERTYPE_VLAN) {
> > +           struct ether_vlan_header *evl = (void *)eh;
> > +           if (EVL_VLANOFTAG(evl->evl_tag) == EVL_VLID_NULL) {
> > +                   etype = ntohs(evl->evl_proto);
> > +                   m->m_pkthdr.pf.prio = EVL_PRIOFTAG(evl-
> > >evl_tag);
> > +                   /* 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;
> > +                   memmove((char *)eh + EVL_ENCAPLEN, eh,
> > sizeof(*eh));
> > +                   m_adj(m, EVL_ENCAPLEN);
> > +           }
> > +   }
> > +
> >     switch (etype) {
> >     case ETHERTYPE_IP:
> >             input = ipv4_input;
> > 

Reply via email to