diff options
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 6b58fe77..23e8b275 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -407,6 +407,10 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token DUP "dup" %token FWD "fwd" +%token NUMGEN "numgen" +%token INC "inc" +%token MOD "mod" + %token POSITION "position" %token COMMENT "comment" @@ -552,8 +556,8 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type <expr> arp_hdr_expr %destructor { expr_free($$); } arp_hdr_expr %type <val> arp_hdr_field -%type <expr> ip_hdr_expr icmp_hdr_expr -%destructor { expr_free($$); } ip_hdr_expr icmp_hdr_expr +%type <expr> ip_hdr_expr icmp_hdr_expr numgen_expr +%destructor { expr_free($$); } ip_hdr_expr icmp_hdr_expr numgen_expr %type <val> ip_hdr_field icmp_hdr_field %type <expr> ip6_hdr_expr icmp6_hdr_expr %destructor { expr_free($$); } ip6_hdr_expr icmp6_hdr_expr @@ -582,7 +586,7 @@ static void location_update(struct location *loc, struct location *rhs, int n) %type <expr> meta_expr %destructor { expr_free($$); } meta_expr -%type <val> meta_key meta_key_qualified meta_key_unqualified +%type <val> meta_key meta_key_qualified meta_key_unqualified numgen_type %type <expr> ct_expr %destructor { expr_free($$); } ct_expr @@ -1967,6 +1971,7 @@ primary_expr : symbol_expr { $$ = $1; } | exthdr_expr { $$ = $1; } | meta_expr { $$ = $1; } | ct_expr { $$ = $1; } + | numgen_expr { $$ = $1; } | '(' basic_expr ')' { $$ = $2; } ; @@ -2454,6 +2459,16 @@ meta_stmt : META meta_key SET expr } ; +numgen_type : INC { $$ = NFT_NG_INCREMENTAL; } + | RANDOM { $$ = NFT_NG_RANDOM; } + ; + +numgen_expr : NUMGEN numgen_type MOD NUM + { + $$ = numgen_expr_alloc(&@$, $2, $4); + } + ; + ct_expr : CT ct_key { $$ = ct_expr_alloc(&@$, $2, -1); |