netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2 nft WIP] Using variables in chain priority
@ 2019-07-16  9:08 Fernando Fernandez Mancera
  2019-07-16  9:08 ` [PATCH 1/2 nft WIP] src: introduce prio_expr " Fernando Fernandez Mancera
  2019-07-16  9:08 ` [PATCH 2/2 nft WIP] src: allow variables " Fernando Fernandez Mancera
  0 siblings, 2 replies; 6+ messages in thread
From: Fernando Fernandez Mancera @ 2019-07-16  9:08 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Fernando Fernandez Mancera

I am getting the following error when I try to load the following file using "nft -f"

File:
define pri = filter
table inet global {
    chain prerouting {
        type filter hook prerouting priority $pri
        policy accept
    }
}


Error:
priority_test:1:14-19: Error: No symbol type information
define pri = filter
             ^^^^^^
priority_test:4:37-49: Error: invalid priority expression symbol in this context.
        type filter hook prerouting priority $pri
                                    ^^^^^^^^^^^^^

The original idea was to evaluate the prio_expr and check the result expression
datatype. This way we could use variables with number priority number and also
strings. It seems that the symbol does not have symbol type information at the
evaluation phase. I have a workaround that consist in allocating a constant
expression with the symbol identifier in the parser but then we should check
the datatype manually in the evaluation. I don't like that solution at all.

Is there any other way to accomplish that? I would like to find a better
solution. Thanks!

Fernando Fernandez Mancera (2):
  src: introduce prio_expr in chain priority
  src: allow variables in chain priority

 include/rule.h     |  8 ++++----
 src/evaluate.c     | 29 +++++++++++++++++++----------
 src/parser_bison.y | 26 ++++++++++++++++++--------
 src/rule.c         |  4 ++--
 4 files changed, 43 insertions(+), 24 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-16 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-16  9:08 [PATCH 0/2 nft WIP] Using variables in chain priority Fernando Fernandez Mancera
2019-07-16  9:08 ` [PATCH 1/2 nft WIP] src: introduce prio_expr " Fernando Fernandez Mancera
2019-07-16 18:06   ` Pablo Neira Ayuso
2019-07-16 22:42     ` Fernando Fernandez Mancera
2019-07-16  9:08 ` [PATCH 2/2 nft WIP] src: allow variables " Fernando Fernandez Mancera
2019-07-16 18:07   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).