diff options
author | Florian Westphal <fw@strlen.de> | 2017-11-18 21:00:58 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-03-03 10:18:12 +0100 |
commit | 0b302bb4c1566d51007fba1081c8d60111664fbc (patch) | |
tree | 20dd2cb0e15c5546c679003b1faaaa89e1dd0ce6 /src | |
parent | 82e732c6e6ae33cd9376fb016fb999704db57674 (diff) |
parser: use nf_key_proto
Consolidate into one so it can be reused by new users.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/parser_bison.y | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 0c9e6c2b..58bc6805 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -675,13 +675,15 @@ int nft_lex(void *, void *, void *); %destructor { expr_free($$); } meta_expr %type <val> meta_key meta_key_qualified meta_key_unqualified numgen_type +%type <val> nf_key_proto + %type <expr> rt_expr %destructor { expr_free($$); } rt_expr -%type <val> rt_key_proto rt_key +%type <val> rt_key %type <expr> ct_expr %destructor { expr_free($$); } ct_expr -%type <val> ct_key ct_dir ct_key_dir_optional ct_key_dir ct_key_proto ct_key_proto_field +%type <val> ct_key ct_dir ct_key_dir_optional ct_key_dir ct_key_proto_field %type <expr> fib_expr %destructor { expr_free($$); } fib_expr @@ -3330,7 +3332,7 @@ hash_expr : JHASH expr MOD NUM SEED NUM offset_opt } ; -rt_key_proto : IP { $$ = NFPROTO_IPV4; } +nf_key_proto : IP { $$ = NFPROTO_IPV4; } | IP6 { $$ = NFPROTO_IPV6; } ; @@ -3338,7 +3340,7 @@ rt_expr : RT rt_key { $$ = rt_expr_alloc(&@$, $2, true); } - | RT rt_key_proto rt_key + | RT nf_key_proto rt_key { enum nft_rt_keys rtk = $3; @@ -3371,7 +3373,7 @@ ct_expr : CT ct_key { $$ = ct_expr_alloc(&@$, $3, $2, NFPROTO_UNSPEC); } - | CT ct_dir ct_key_proto ct_key_proto_field + | CT ct_dir nf_key_proto ct_key_proto_field { $$ = ct_expr_alloc(&@$, $4, $2, $3); } @@ -3407,10 +3409,6 @@ ct_key_dir : SADDR { $$ = NFT_CT_SRC; } | ct_key_dir_optional ; -ct_key_proto : IP { $$ = NFPROTO_IPV4; } - | IP6 { $$ = NFPROTO_IPV6; } - ; - ct_key_proto_field : SADDR { $$ = NFT_CT_SRC; } | DADDR { $$ = NFT_CT_DST; } ; |