summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2017-11-23 15:14:01 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-11-24 15:03:28 +0100
commit48661c54357aea271bf87ab2b6ef907eafc97e9a (patch)
tree9222b459849f9db7332b71866df33225d9b12920 /src/parser_bison.y
parent932847e0c3df8f6ee3dc4478f1ef0728926d9544 (diff)
src: deprecate "flow table" syntax, replace it by "meter"
According to bugzilla 1137: "flow tables" should not be syntactically unique. "Flow tables are always named, but they don't conform to the way sets, maps, and dictionaries work in terms of "add" and "delete" and all that. They are also "flow tables" instead of one word like "flows" or "throttle" or something. It seems weird to just have these break the syntactic expectations." Personally, I never liked the reference to "table" since we have very specific semantics in terms of what a "table" is netfilter for long time. This patch promotes "meter" as the new keyword. The former syntax is still accepted for a while, just to reduce chances of breaking things. At some point the former syntax will just be removed. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1137 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y68
1 files changed, 45 insertions, 23 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index c64c3979..6610b9dc 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -243,6 +243,8 @@ int nft_lex(void *, void *, void *);
%token SIZE "size"
%token FLOW "flow"
+%token METER "meter"
+%token METERS "meters"
%token <val> NUM "number"
%token <string> STRING "string"
@@ -555,8 +557,8 @@ int nft_lex(void *, void *, void *);
%type <stmt> set_stmt
%destructor { stmt_free($$); } set_stmt
%type <val> set_stmt_op
-%type <stmt> flow_stmt flow_stmt_alloc
-%destructor { stmt_free($$); } flow_stmt flow_stmt_alloc
+%type <stmt> meter_stmt meter_stmt_alloc
+%destructor { stmt_free($$); } meter_stmt meter_stmt_alloc
%type <expr> symbol_expr verdict_expr integer_expr variable_expr
%destructor { expr_free($$); } symbol_expr verdict_expr integer_expr variable_expr
@@ -606,8 +608,8 @@ int nft_lex(void *, void *, void *);
%type <expr> set_elem_expr_stmt set_elem_expr_stmt_alloc
%destructor { expr_free($$); } set_elem_expr_stmt set_elem_expr_stmt_alloc
-%type <expr> flow_key_expr flow_key_expr_alloc
-%destructor { expr_free($$); } flow_key_expr flow_key_expr_alloc
+%type <expr> meter_key_expr meter_key_expr_alloc
+%destructor { expr_free($$); } meter_key_expr meter_key_expr_alloc
%type <expr> expr initializer_expr keyword_expr
%destructor { expr_free($$); } expr initializer_expr keyword_expr
@@ -1084,11 +1086,19 @@ list_cmd : TABLE table_spec
}
| FLOW TABLES ruleset_spec
{
- $$ = cmd_alloc(CMD_LIST, CMD_OBJ_FLOWTABLES, &$3, &@$, NULL);
+ $$ = cmd_alloc(CMD_LIST, CMD_OBJ_METERS, &$3, &@$, NULL);
}
| FLOW TABLE set_spec
{
- $$ = cmd_alloc(CMD_LIST, CMD_OBJ_FLOWTABLE, &$3, &@$, NULL);
+ $$ = cmd_alloc(CMD_LIST, CMD_OBJ_METER, &$3, &@$, NULL);
+ }
+ | METERS ruleset_spec
+ {
+ $$ = cmd_alloc(CMD_LIST, CMD_OBJ_METERS, &$2, &@$, NULL);
+ }
+ | METER set_spec
+ {
+ $$ = cmd_alloc(CMD_LIST, CMD_OBJ_METER, &$2, &@$, NULL);
}
| MAPS ruleset_spec
{
@@ -1152,7 +1162,11 @@ flush_cmd : TABLE table_spec
}
| FLOW TABLE set_spec
{
- $$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_FLOWTABLE, &$3, &@$, NULL);
+ $$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_METER, &$3, &@$, NULL);
+ }
+ | METER set_spec
+ {
+ $$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_METER, &$2, &@$, NULL);
}
| RULESET ruleset_spec
{
@@ -1782,7 +1796,7 @@ stmt_list : stmt
stmt : verdict_stmt
| match_stmt
- | flow_stmt
+ | meter_stmt
| counter_stmt
| payload_stmt
| meta_stmt
@@ -2468,38 +2482,46 @@ set_stmt_op : ADD { $$ = NFT_DYNSET_OP_ADD; }
| UPDATE { $$ = NFT_DYNSET_OP_UPDATE; }
;
-flow_stmt : flow_stmt_alloc flow_stmt_opts '{' flow_key_expr stmt '}'
+meter_stmt : meter_stmt_alloc meter_stmt_opts '{' meter_key_expr stmt '}'
{
- $1->flow.key = $4;
- $1->flow.stmt = $5;
+ $1->meter.key = $4;
+ $1->meter.stmt = $5;
$$->location = @$;
$$ = $1;
}
- | flow_stmt_alloc '{' flow_key_expr stmt '}'
+ | meter_stmt_alloc '{' meter_key_expr stmt '}'
{
- $1->flow.key = $3;
- $1->flow.stmt = $4;
+ $1->meter.key = $3;
+ $1->meter.stmt = $4;
$$->location = @$;
$$ = $1;
}
;
-flow_stmt_alloc : FLOW
+meter_stmt_alloc : FLOW
+ {
+ $$ = meter_stmt_alloc(&@$);
+ }
+ | METER
{
- $$ = flow_stmt_alloc(&@$);
+ $$ = meter_stmt_alloc(&@$);
}
;
-flow_stmt_opts : flow_stmt_opt
+meter_stmt_opts : meter_stmt_opt
{
$<stmt>$ = $<stmt>0;
}
- | flow_stmt_opts flow_stmt_opt
+ | meter_stmt_opts meter_stmt_opt
;
-flow_stmt_opt : TABLE identifier
+meter_stmt_opt : TABLE identifier
+ {
+ $<stmt>0->meter.name = $2;
+ }
+ | NAME identifier
{
- $<stmt>0->flow.table = $2;
+ $<stmt>0->meter.name = $2;
}
;
@@ -2738,15 +2760,15 @@ set_list_member_expr : opt_newline set_expr opt_newline
}
;
-flow_key_expr : flow_key_expr_alloc
- | flow_key_expr_alloc set_elem_options
+meter_key_expr : meter_key_expr_alloc
+ | meter_key_expr_alloc set_elem_options
{
$$->location = @$;
$$ = $1;
}
;
-flow_key_expr_alloc : concat_expr
+meter_key_expr_alloc : concat_expr
{
$$ = set_elem_expr_alloc(&@1, $1);
}