From: Florian Westphal Date: Thu, 29 Feb 2024 10:41:23 +0000 (+0100) Subject: parser: allow typeof in objref maps X-Git-Tag: v1.1.0~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25f1e6ccc0590e1081879022809afb83fc45f673;p=thirdparty%2Fnftables.git 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 --- 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;