]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
concat with dynamically sized fields like vlan id
authorMichael Braun <michael-dev@fami-braun.de>
Thu, 28 Jul 2022 09:36:44 +0000 (11:36 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 11 Aug 2022 06:03:54 +0000 (08:03 +0200)
This enables commands like

 nft set bridge t s4 '{typeof vlan id . ip daddr; elements = { 3567 .
1.2.3.4 }; }'

Which would previously fail with
  Error: can not use variable sized data types (integer) in concat
  expressions

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/sets/dumps/typeof_sets_0.nft
tests/shell/testcases/sets/typeof_sets_0

index 68b4dcc56e9ad6a8d6cab3f9b1c7496e6997453f..6f5b83af6bb9203404c7cc9da9e2c94c2841ca09 100644 (file)
@@ -50,6 +50,11 @@ table inet t {
                elements = { "eth0" . 10.1.1.2 . 42 }
        }
 
+       set s11 {
+               typeof vlan id . ip saddr
+               elements = { 3567 . 1.2.3.4 }
+       }
+
        chain c1 {
                osf name @s1 accept
        }
@@ -85,4 +90,8 @@ table inet t {
        chain c10 {
                iifname . ip saddr . ipsec in reqid @s10 accept
        }
+
+       chain c11 {
+               vlan id . ip saddr @s11 accept
+       }
 }
index 5fc6a1214729d121c121b9d4ee93035a2e796578..9f777a8c90bc597eac602d7aba74ece8010496d4 100755 (executable)
@@ -55,6 +55,11 @@ EXPECTED="table inet t {
                elements = { \"eth0\" . 10.1.1.2 . 42 }
        }
 
+       set s11 {
+               typeof vlan id . ip saddr
+               elements = { 3567 . 1.2.3.4 }
+       }
+
        chain c1 {
                osf name @s1 accept
        }
@@ -90,6 +95,10 @@ EXPECTED="table inet t {
        chain c10 {
                meta iifname . ip saddr . ipsec in reqid @s10 accept
        }
+
+       chain c11 {
+               ether type vlan vlan id . ip saddr @s11 accept
+       }
 }"
 
 set -e