summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-08-04 22:24:22 +0200
committerFlorian Westphal <fw@strlen.de>2019-12-17 23:10:32 +0100
commit6e48df5329eab9b8316eb0d40f77b5a9457741a8 (patch)
treeb597311a61de695691fb5bbf46ff233fe5cf667a /src/parser_bison.y
parent14357cff40eda63f75efc878324aaaafbf3ed748 (diff)
src: add "typeof" build/parse/print support
This patch adds two new expression operations to build and to parse the userdata area that describe the set key and data typeof definitions. For maps, the grammar enforces either "type data_type : data_type" or or "typeof expression : expression". Check both key and data for valid user typeof info first. If they check out, flag set->key_typeof_valid as true and use it for printing the key info. This patch comes with initial support for using payload expressions with the 'typeof' keyword, followup patches will add support for other expressions as well. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 89ec564c..799f7a30 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1675,6 +1675,13 @@ chain_block : /* empty */ { $$ = $<chain>-1; }
typeof_expr : primary_expr
{
+ if (expr_ops($1)->build_udata == NULL) {
+ erec_queue(error(&@1, "primary expression type '%s' lacks typeof serialization", expr_ops($1)->name),
+ state->msgs);
+ expr_free($1);
+ YYERROR;
+ }
+
$$ = $1;
}
| typeof_expr DOT primary_expr