Re: Double stacked VLANs (was Re: Question on header check)

Alex Zeffertt <[email protected]> Mon, 19 Jun 2006 09:46:39 +0100
Newsgroups gmane.linux.drivers.vlan
Message-ID <[email protected]>
Frederik Deweerdt wrote:
> On Fri, Jun 16, 2006 at 01:12:06PM +0100, Alex Zeffertt wrote:
>>>> Another possible problem:  what if you are trying to encapsulate vlan 7 inside
>>>> of vlan 7.  How do you know to double-encapsulate?  What if user-space is sending
>>>> a pre-built VLAN frame with a raw socket?  I'm not sure there is enough info as to
>>>> the intent to encapsulate or not once the VLAN code receives the packet.
>>> I see how my proposal was wrong. Let me wild guess again :). I wondered if the following
>>> code could be better. The idea being that the code could determine the need for
>>> encapsulating or not from the interface's nesting level and the actual number of VLAN tags in the packet.
>>
>>
>> I think we've had this conversation before.  Search the list archives for "vlan Q in Q"
> Thanks for the pointer. Do you know why your patch didn't get merged into mainline?
> 

A couple of reasons.  Firstly the patch means that the REORDER_HEADER flag (which is set by
default) cannot be unset.  Unsetting this flag provides a slight performance enhancement
when bridging between two interfaces and keeping the same tag.

Secondly, the current code allows you to send either untagged or tagged frames to a raw
socket and the result is the same, a tagged frame is sent.  The patch however, always
adds a tag irrespective of whether the frame was already tagged.  (This functionality
*had* to be ditched because if you allow q-in-q then you may *want* your frame double tagged.)

IMHO, raw sockets *should* always tag, rather than tag or not tag depending on whether the
frame is already tagged.  It just seems more logical and consistent.

Ciao,

Alex