aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/nftables/patches/001-parser-allow-quoted-string-in-flowtable_expr_member.patch
blob: 3090adec253b03196818ad417c3bd8f460aa2d7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 07af4429241c9832a613cb8620331ac54257d9df Mon Sep 17 00:00:00 2001
From: Stijn Tintel <stijn@linux-ipv6.be>
Date: Tue, 21 Dec 2021 12:40:25 +0200
Subject: [PATCH] parser: allow quoted string in flowtable_expr_member

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/parser_bison.y b/src/parser_bison.y
index 16607bb7..1136ab91 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -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,
-- 
2.33.1