Previous patches added "8021ad" mnemonic for IEEE 802.1AD frame type.
This adds the 8021q shorthand for the existing 'vlan' frame type.
nft will continue to recognize 'ether type vlan', but listing
will now print 8021q.
Adjust all test cases accordingly.
Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
SYMBOL("ip", __constant_htons(ETH_P_IP)),
SYMBOL("arp", __constant_htons(ETH_P_ARP)),
SYMBOL("ip6", __constant_htons(ETH_P_IPV6)),
- SYMBOL("vlan", __constant_htons(ETH_P_8021Q)),
+ SYMBOL("8021q", __constant_htons(ETH_P_8021Q)),
SYMBOL("8021ad", __constant_htons(ETH_P_8021AD)),
+
+ /* for compatibility with older versions */
+ SYMBOL("vlan", __constant_htons(ETH_P_8021Q)),
SYMBOL_LIST_END
},
};
"pcp" { return PCP; }
}
"8021ad" { yylval->string = xstrdup(yytext); return STRING; }
+"8021q" { yylval->string = xstrdup(yytext); return STRING; }
"arp" { scanner_push_start_cond(yyscanner, SCANSTATE_ARP); return ARP; }
<SCANSTATE_ARP>{
meta length { 33-55, 66-88};ok
meta length != { 33-55, 66-88};ok
-meta protocol { ip, arp, ip6, vlan };ok;meta protocol { ip6, ip, vlan, arp}
-meta protocol != {ip, arp, ip6, vlan};ok
+meta protocol { ip, arp, ip6, vlan };ok;meta protocol { ip6, ip, 8021q, arp}
+meta protocol != {ip, arp, ip6, 8021q};ok
meta protocol ip;ok
meta protocol != ip;ok
}
]
-# meta protocol != {ip, arp, ip6, vlan}
+# meta protocol != {ip, arp, ip6, 8021q}
[
{
"match": {
"ip",
"arp",
"ip6",
- "vlan"
+ "8021q"
]
}
}
"set": [
"ip",
"arp",
- "vlan",
+ "8021q",
"ip6"
]
}
}
]
-# meta protocol != {ip, arp, ip6, vlan}
+# meta protocol != {ip, arp, ip6, 8021q}
[
{
"match": {
"set": [
"ip",
"arp",
- "vlan",
+ "8021q",
"ip6"
]
}
[ meta load protocol => reg 1 ]
[ lookup reg 1 set __set%d ]
-# meta protocol != {ip, arp, ip6, vlan}
+# meta protocol != {ip, arp, ip6, 8021q}
__set%d test-ip4 3
__set%d test-ip4 0
element 00000008 : 0 [end] element 00000608 : 0 [end] element 0000dd86 : 0 [end] element 00000081 : 0 [end]
meta obrname "br0";ok
meta ibrname "br0";ok
-meta ibrvproto vlan;ok
+meta ibrvproto vlan;ok;meta ibrvproto 8021q
meta ibrpvid 100;ok
"meta": { "key": "ibrvproto" }
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
}
]
ether type ipv6 reject with icmp type host-unreachable;fail
ether type ip6 reject with icmp type host-unreachable;fail
ether type ip reject with icmpv6 type no-route;fail
-ether type vlan reject;ok
+ether type vlan reject;ok;ether type 8021q reject
ether type arp reject;fail
-ether type vlan reject with tcp reset;ok;meta l4proto 6 ether type vlan reject with tcp reset
+ether type vlan reject with tcp reset;ok;meta l4proto 6 ether type 8021q reject with tcp reset
ether type arp reject with tcp reset;fail
ip protocol udp reject with tcp reset;fail
ether type ip reject with icmpx type admin-prohibited;ok
ether type ip6 reject with icmpx type admin-prohibited;ok
-ether type vlan reject with icmpx type admin-prohibited;ok
+ether type 8021q reject with icmpx type admin-prohibited;ok
ether type arp reject with icmpx type admin-prohibited;fail
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
]
-# ether type vlan reject with icmpx type admin-prohibited
+# ether type 8021q reject with icmpx type admin-prohibited
[
{
"match": {
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
}
]
-
[ cmp eq reg 1 0x00000081 ]
[ reject type 1 code 0 ]
-# ether type vlan reject with icmpx type admin-prohibited
+# ether type 8021q reject with icmpx type admin-prohibited
bridge
[ payload load 2b @ link header + 12 => reg 1 ]
[ cmp eq reg 1 0x00000081 ]
vlan id { 1, 2, 4, 100, 4095 } vlan pcp 1-3;ok
vlan id { 1, 2, 4, 100, 4096 };fail
-ether type vlan ip protocol 1 accept;ok
+ether type vlan ip protocol 1 accept;ok;ether type 8021q ip protocol 1 accept
# IEEE 802.1AD
ether type 8021ad vlan id 1 ip protocol 6 accept;ok
-ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip counter;ok
-ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip ip protocol 6;ok;ether type 8021ad vlan id 1 vlan type vlan vlan id 2 ip protocol 6
+ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip counter;ok
+ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip ip protocol 6;ok;ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 ip protocol 6
# illegal dependencies
ether type ip vlan id 1;fail
}
]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip counter
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip counter
[
{
"match": {
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip ip protocol 6
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip ip protocol 6
[
{
"match": {
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip counter
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip counter
[
{
"match": {
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
}
]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip ip protocol 6
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip ip protocol 6
[
{
"match": {
}
},
"op": "==",
- "right": "vlan"
+ "right": "8021q"
}
},
{
[ cmp eq reg 1 0x00000006 ]
[ immediate reg 0 accept ]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip counter
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip counter
bridge
[ payload load 2b @ link header + 12 => reg 1 ]
[ cmp eq reg 1 0x0000a888 ]
[ cmp eq reg 1 0x00000008 ]
[ counter pkts 0 bytes 0 ]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip ip protocol 6
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip ip protocol 6
bridge
[ payload load 2b @ link header + 12 => reg 1 ]
[ cmp eq reg 1 0x0000a888 ]
[ cmp eq reg 1 0x00000006 ]
[ immediate reg 0 accept ]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip counter
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip counter
netdev
[ meta load iiftype => reg 1 ]
[ cmp eq reg 1 0x00000001 ]
[ cmp eq reg 1 0x00000008 ]
[ counter pkts 0 bytes 0 ]
-# ether type 8021ad vlan id 1 vlan type vlan vlan id 2 vlan type ip ip protocol 6
+# ether type 8021ad vlan id 1 vlan type 8021q vlan id 2 vlan type ip ip protocol 6
netdev
[ meta load iiftype => reg 1 ]
[ cmp eq reg 1 0x00000001 ]