Skip to contentSkip to conversation

meta: add ibrpvid and ibrvproto support

PATCH Superseded [email protected] 2 participants 2 messages Aug 14, 2019 netfilter

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta: add ibrpvid and ibrvproto support

From: wenxu <[email protected]>

This can match the the pvid and vlan_proto of ibr

nft add rule bridge firewall zones meta ibrvproto 0x8100 nft add rule bridge firewall zones meta ibrpvid 100

---
 src/meta.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/meta.c +6 -0
index 5901c99..d45d757 100644
@@ -442,6 +442,12 @@ const struct meta_template meta_templates[] = {
 	[NFT_META_OIFKIND]	= META_TEMPLATE("oifkind",   &ifname_type,
 						IFNAMSIZ * BITS_PER_BYTE,
 						BYTEORDER_HOST_ENDIAN),
+	[NFT_META_BRI_IIFPVID]	= META_TEMPLATE("ibrpvid",   &integer_type,
+						2 * BITS_PER_BYTE,
+						BYTEORDER_HOST_ENDIAN),
+	[NFT_META_BRI_IIFVPROTO] = META_TEMPLATE("ibrvproto",   &integer_type,
+						2 * BITS_PER_BYTE,
+						BYTEORDER_HOST_ENDIAN),
 };
 
 static bool meta_key_is_unqualified(enum nft_meta_keys key)
Signature · 1 line
2.15.1
#1 lore raw
Quoted 3 lines · On Wed, Aug 14, 2019 at 02:59:36PM +0800, [email protected] wrote:

From: wenxu <[email protected]>

This can match the the pvid and vlan_proto of ibr

This allows you to match the bridge pvid and vlan protocol, for instance:

Quoted 6 lines

nft add rule bridge firewall zones meta ibrvproto 0x8100 nft add rule bridge firewall zones meta ibrpvid 100

---
 src/meta.c | 6 ++++++

tests/py update is missing. Please update tests/py -j (json) too.

Quoted 22 lines
 1 file changed, 6 insertions(+)
src/meta.c +6 -0
index 5901c99..d45d757 100644
@@ -442,6 +442,12 @@ const struct meta_template meta_templates[] = {
 	[NFT_META_OIFKIND]	= META_TEMPLATE("oifkind",   &ifname_type,
 						IFNAMSIZ * BITS_PER_BYTE,
 						BYTEORDER_HOST_ENDIAN),
+	[NFT_META_BRI_IIFPVID]	= META_TEMPLATE("ibrpvid",   &integer_type,
+						2 * BITS_PER_BYTE,
+						BYTEORDER_HOST_ENDIAN),
+	[NFT_META_BRI_IIFVPROTO] = META_TEMPLATE("ibrvproto",   &integer_type,
+						2 * BITS_PER_BYTE,
+						BYTEORDER_HOST_ENDIAN),
 };
 
 static bool meta_key_is_unqualified(enum nft_meta_keys key)
Signature · 1 line
2.15.1