diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-16 20:39:20 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2014-01-16 20:39:20 +0000 |
commit | 807b936bb3d9bb2c924c742a0548337089494968 (patch) | |
tree | 61198b487730ad1b434db66ec2f1e002b66d18c2 /src/parser.y | |
parent | 0dbced3615ffdbb212ba4f791475a7c65a525309 (diff) | |
parent | bea7aab38f305bb8c2e400d575e6bd0a3c6bbc1f (diff) |
Merge remote-tracking branch 'origin/master' into next-3.14
Signed-off-by: Patrick McHardy <kaber@trash.net>
Conflicts:
include/nftables.h
src/main.c
Diffstat (limited to 'src/parser.y')
-rw-r--r-- | src/parser.y | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/parser.y b/src/parser.y index fd631368..3e3abedd 100644 --- a/src/parser.y +++ b/src/parser.y @@ -150,7 +150,6 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token ASTERISK "*" %token DASH "-" %token AT "@" -%token ARROW "=>" %token VMAP "vmap" %token INCLUDE "include" @@ -184,6 +183,10 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token GOTO "goto" %token RETURN "return" +%token CONSTANT "constant" +%token INTERVAL "interval" +%token ELEMENTS "elements" + %token <val> NUM "number" %token <string> STRING "string" %token <string> QUOTED_STRING @@ -364,6 +367,8 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type <rule> rule %destructor { rule_free($$); } rule +%type <val> set_flag_list set_flag + %type <set> set_block_alloc set_block %destructor { set_free($$); } set_block_alloc @@ -751,6 +756,27 @@ set_block : /* empty */ { $$ = $<set>-1; } } $$ = $1; } + | set_block FLAGS set_flag_list stmt_seperator + { + $1->flags = $3; + $$ = $1; + } + | set_block ELEMENTS '=' set_expr + { + $1->init = $4; + $$ = $1; + } + ; + +set_flag_list : set_flag_list COMMA set_flag + { + $$ = $1 | $3; + } + | set_flag + ; + +set_flag : CONSTANT { $$ = SET_F_CONSTANT; } + | INTERVAL { $$ = SET_F_INTERVAL; } ; map_block_alloc : /* empty */ @@ -764,7 +790,7 @@ map_block : /* empty */ { $$ = $<set>-1; } | map_block common_block | map_block stmt_seperator | map_block TYPE - identifier ARROW identifier + identifier COLON identifier stmt_seperator { $1->keytype = datatype_lookup_byname($3); @@ -783,6 +809,16 @@ map_block : /* empty */ { $$ = $<set>-1; } $$ = $1; } + | map_block FLAGS set_flag_list stmt_seperator + { + $1->flags = $3; + $$ = $1; + } + | map_block ELEMENTS '=' set_expr + { + $1->init = $4; + $$ = $1; + } ; hook_spec : TYPE STRING HOOK STRING PRIORITY NUM @@ -1309,11 +1345,11 @@ set_list_member_expr : opt_newline expr opt_newline { $$ = $2; } - | opt_newline map_lhs_expr ARROW concat_expr opt_newline + | opt_newline map_lhs_expr COLON concat_expr opt_newline { $$ = mapping_expr_alloc(&@$, $2, $4); } - | opt_newline map_lhs_expr ARROW verdict_expr opt_newline + | opt_newline map_lhs_expr COLON verdict_expr opt_newline { $$ = mapping_expr_alloc(&@$, $2, $4); } |