[PATCH nft 1/3] parser: allow typeof in objref maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <fw@xxxxxxxxx>
---
 src/parser_bison.y | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/parser_bison.y b/src/parser_bison.y
index cba37c686f66..cd1dc658882d 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -2340,6 +2340,15 @@ map_block		:	/* empty */	{ $$ = $<set>-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;
-- 
2.43.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux