Hi Fernando,
On Tue, May 14, 2019 at 05:43:39PM +0200, Fernando Fernandez Mancera wrote:
> This last patch does not work. The first one works fine with a string as
> chain name.
>
[...]
>
> But when trying to execute "# nft -f file.nft", being file.nft:
>
> > define dest = ber
> > add rule ip foo bar jump $dest
>
> I am getting the following error:
>
> file.nft:3:26-30: Error: Can't parse symbolic netfilter verdict expressions
> add rule ip foo bar jump $dest
> ^^^^^
> This error comes from symbol_parse() at expr_evaluate_symbol() after the
> expr_evaluate() call added in the first patch.
Yes, symbol_expr is used only for symbolic constants, therefore
symbol_parse() is very restrictive.
[...]
> > diff --git a/src/parser_bison.y b/src/parser_bison.y
> > index 69b5773..42fd71f 100644
> > --- a/src/parser_bison.y
> > +++ b/src/parser_bison.y
> > @@ -3841,7 +3841,13 @@ verdict_expr : ACCEPT
> > }
> > ;
> >
> > -chain_expr : identifier
> > +chain_expr : variable_expr
> > + {
> > + $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE,
> > + current_scope(state),
> > + $1->sym->identifier);
> > + }
I didn't test it, but you can probably just drop the curly braces and
everything inside here. 'variable_expr' already turns into an
expression (a variable_expr, not symbol_expr), which is probably what
you want.
> > + | identifier
> > {
> > $$ = constant_expr_alloc(&@$, &string_type,
> > BYTEORDER_HOST_ENDIAN,
> >
>
Cheers, Phil