3090adec253b03196818ad417c3bd8f460aa2d7e
[openwrt/staging/mkresin.git] / package / network / utils / nftables / patches / 001-parser-allow-quoted-string-in-flowtable_expr_member.patch
1 From 07af4429241c9832a613cb8620331ac54257d9df Mon Sep 17 00:00:00 2001
2 From: Stijn Tintel <stijn@linux-ipv6.be>
3 Date: Tue, 21 Dec 2021 12:40:25 +0200
4 Subject: [PATCH] parser: allow quoted string in flowtable_expr_member
5
6 Devices with interface names starting with a digit can not be configured
7 in flowtables. Trying to do so throws the following error:
8
9 Error: syntax error, unexpected number, expecting comma or '}'
10 devices = { eth0, 6in4-wan6 };
11
12 This is however a perfectly valid interface name. Solve the issue by
13 allowing the use of quoted strings.
14
15 Suggested-by: Jo-Philipp Wich <jo@mein.io>
16 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
17 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
18 ---
19 src/parser_bison.y | 9 ++++++++-
20 1 file changed, 8 insertions(+), 1 deletion(-)
21
22 diff --git a/src/parser_bison.y b/src/parser_bison.y
23 index 16607bb7..1136ab91 100644
24 --- a/src/parser_bison.y
25 +++ b/src/parser_bison.y
26 @@ -2151,7 +2151,14 @@ flowtable_list_expr : flowtable_expr_member
27 | flowtable_list_expr COMMA opt_newline
28 ;
29
30 -flowtable_expr_member : STRING
31 +flowtable_expr_member : QUOTED_STRING
32 + {
33 + $$ = constant_expr_alloc(&@$, &string_type,
34 + BYTEORDER_HOST_ENDIAN,
35 + strlen($1) * BITS_PER_BYTE, $1);
36 + xfree($1);
37 + }
38 + | STRING
39 {
40 $$ = constant_expr_alloc(&@$, &string_type,
41 BYTEORDER_HOST_ENDIAN,
42 --
43 2.33.1
44