summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-03-04 02:07:35 +0100
committerFlorian Westphal <fw@strlen.de>2021-03-06 01:12:25 +0100
commitdea5bb083331a8061620d950adf11e1ed60d6efd (patch)
tree74a03b273264a33f55388de4af451cda44615cb0
parentf04ae7d3969c48084180e524841fd1fb1f68ffbe (diff)
parser: compact ct obj list types
Add new ct_cmd_type and avoid copypaste of the ct cmd_list rules. Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r--src/parser_bison.y19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index c4f3e341..bfb18174 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -838,7 +838,7 @@ int nft_lex(void *, void *, void *);
%destructor { expr_free($$); } exthdr_exists_expr
%type <val> exthdr_key
-%type <val> ct_l4protoname ct_obj_type
+%type <val> ct_l4protoname ct_obj_type ct_cmd_type
%type <list> timeout_states timeout_state
%destructor { xfree($$); } timeout_states timeout_state
@@ -1393,17 +1393,9 @@ list_cmd : TABLE table_spec
{
$$ = cmd_alloc_obj_ct(CMD_LIST, $2, &$3, &@$, NULL);
}
- | CT HELPERS TABLE table_spec
+ | CT ct_cmd_type TABLE table_spec
{
- $$ = cmd_alloc(CMD_LIST, CMD_OBJ_CT_HELPERS, &$4, &@$, NULL);
- }
- | CT TIMEOUT TABLE table_spec
- {
- $$ = cmd_alloc(CMD_LIST, CMD_OBJ_CT_TIMEOUT, &$4, &@$, NULL);
- }
- | CT EXPECTATION TABLE table_spec
- {
- $$ = cmd_alloc(CMD_LIST, CMD_OBJ_CT_EXPECT, &$4, &@$, NULL);
+ $$ = cmd_alloc(CMD_LIST, $2, &$4, &@$, NULL);
}
;
@@ -4292,6 +4284,11 @@ ct_obj_type : HELPER { $$ = NFT_OBJECT_CT_HELPER; }
| EXPECTATION { $$ = NFT_OBJECT_CT_EXPECT; }
;
+ct_cmd_type : HELPERS { $$ = CMD_OBJ_CT_HELPERS; }
+ | TIMEOUT { $$ = CMD_OBJ_CT_TIMEOUT; }
+ | EXPECTATION { $$ = CMD_OBJ_CT_EXPECT; }
+ ;
+
ct_l4protoname : TCP { $$ = IPPROTO_TCP; }
| UDP { $$ = IPPROTO_UDP; }
;