From 25f1e6ccc0590e1081879022809afb83fc45f673 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 29 Feb 2024 11:41:23 +0100 Subject: parser: allow typeof in objref maps Its currently not possible to declare a map that stores object references with the "typeof" keyword, e.g. map m { type ipv4_addr : limit will work, but map m { typeof ip saddr : limit will give a syntax error ("unexpected limit"). Followup pach will add support for listing side too. Signed-off-by: Florian Westphal --- src/parser_bison.y | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index cba37c68..cd1dc658 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -2340,6 +2340,15 @@ map_block : /* empty */ { $$ = $-1; } $1->flags |= NFT_SET_OBJECT; $$ = $1; } + | map_block TYPEOF + typeof_expr COLON map_block_obj_type + stmt_separator + { + $1->key = $3; + $1->objtype = $5; + $1->flags |= NFT_SET_OBJECT; + $$ = $1; + } | map_block FLAGS set_flag_list stmt_separator { $1->flags |= $3; -- cgit v1.2.3