diff options
author | Florian Westphal <fw@strlen.de> | 2017-02-28 00:59:07 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-02-28 00:59:42 +0100 |
commit | ed66d9966294a3bab6c8611e369861ba57374743 (patch) | |
tree | aa91c0359789cb81f82a9c06c7be160965ee01be /src/parser_bison.y | |
parent | 2d09a04a12c8564f8044788b2e69da04671230d7 (diff) |
src: support zone set statement with optional direction
nft automatically understands 'ct zone set 1' but when a direction is
specified too we get a parser error since they are currently only
allowed for plain ct expressions.
This permits the existing syntax ('ct original zone') for all tokens with
an optional direction also for set statements.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 80ac2bd0..36d46050 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -2977,7 +2977,7 @@ ct_key_dir_optional : BYTES { $$ = NFT_CT_BYTES; } ct_stmt : CT ct_key SET expr { - $$ = ct_stmt_alloc(&@$, $2, $4); + $$ = ct_stmt_alloc(&@$, $2, -1, $4); } | CT STRING SET expr { @@ -2990,7 +2990,20 @@ ct_stmt : CT ct_key SET expr YYERROR; } - $$ = ct_stmt_alloc(&@$, key, $4); + $$ = ct_stmt_alloc(&@$, key, -1, $4); + } + | CT STRING ct_key_dir_optional SET expr + { + struct error_record *erec; + int8_t direction; + + erec = ct_dir_parse(&@$, $2, &direction); + if (erec != NULL) { + erec_queue(erec, state->msgs); + YYERROR; + } + + $$ = ct_stmt_alloc(&@$, $3, direction, $5); } ; |