[Bridge] [PATCH nf-next v2] netfilter:nft_meta: add NFT_META_VLAN support

wenxu wenxu at ucloud.cn
Sat Jul 6 14:29:14 UTC 2019

在 2019/7/6 20:02, Nikolay Aleksandrov 写道:
> On 05/07/2019 16:16, wenxu at ucloud.cn wrote:
>> From: wenxu <wenxu at ucloud.cn>
>> This patch provide a meta vlan to set the vlan tag of the packet.
>> for q-in-q outer vlan id 20:
>> meta vlan set 0x88a8:20
>> set the default 0x8100 vlan type with vlan id 20
>> meta vlan set 20
>> Signed-off-by: wenxu <wenxu at ucloud.cn>
>> ---
>>  include/net/netfilter/nft_meta.h         |  5 ++++-
>>  include/uapi/linux/netfilter/nf_tables.h |  4 ++++
>>  net/netfilter/nft_meta.c                 | 25 +++++++++++++++++++++++++
>>  3 files changed, 33 insertions(+), 1 deletion(-)
> The patch looks fine, just a note: you'll only be able to work with the
> outer tag, so guessing to achieve a double-tagged frame you'll have to
> add another NFT_META_VLAN_INNER(?) and will have to organize them one
> after another.

yes, It's just set/mangle the meta vlan data. 
I think it's a good idear for stacked tagged with NFT_META_VLAN_INNER, in 
this case it should check the the proto of vlan tag already on packet
There are three case:
1. packet already contain a vlan header with proto 0x88a8, it should push the inner vlan tag
2. there is no outer vlan tag, maybe we should add a inner 0x8100 tag 
and outer 0x88a8 tag?
3.  packet already contain a vlan tag with proto 0x8100, push the vlan tag and add outer 0x88a8 tag ?


More information about the Bridge mailing list