]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser: allow quoted string in flowtable_expr_member
authorStijn Tintel <stijn@linux-ipv6.be>
Tue, 21 Dec 2021 10:40:25 +0000 (12:40 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Dec 2021 23:22:34 +0000 (00:22 +0100)
Devices with interface names starting with a digit can not be configured
in flowtables. Trying to do so throws the following error:

Error: syntax error, unexpected number, expecting comma or '}'
devices = { eth0, 6in4-wan6 };

This is however a perfectly valid interface name. Solve the issue by
allowing the use of quoted strings.

Suggested-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_bison.y

index 16607bb79bdda99a7c327f7be023c896e71a6352..1136ab911f0f4279898b3ffd25efae49a0895cfc 100644 (file)
@@ -2151,7 +2151,14 @@ flowtable_list_expr      :       flowtable_expr_member
                        |       flowtable_list_expr     COMMA   opt_newline
                        ;
 
-flowtable_expr_member  :       STRING
+flowtable_expr_member  :       QUOTED_STRING
+                       {
+                               $$ = constant_expr_alloc(&@$, &string_type,
+                                                        BYTEORDER_HOST_ENDIAN,
+                                                        strlen($1) * BITS_PER_BYTE, $1);
+                               xfree($1);
+                       }
+                       |       STRING
                        {
                                $$ = constant_expr_alloc(&@$, &string_type,
                                                         BYTEORDER_HOST_ENDIAN,