diff mbox series

[nft] parser: support of maps with timeout

Message ID 20180302095018.pxmoybggn753e5dh@nevthink
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft] parser: support of maps with timeout | expand

Commit Message

nevola March 2, 2018, 9:50 a.m. UTC
Support of key and value association with a certain timeout.

Example:

nft add map nftlb mapa { type inet_service: ipv4_addr\;
 timeout 5s\; }

Results in:

table ip nftlb {
	map mapa {
		type inet_service : ipv4_addr
		timeout 5s
	}
}

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
---
 src/parser_bison.y | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Pablo Neira Ayuso March 2, 2018, 10:47 a.m. UTC | #1
On Fri, Mar 02, 2018 at 10:50:18AM +0100, Laura Garcia Liebana wrote:
> Support of key and value association with a certain timeout.
> 
> Example:
> 
> nft add map nftlb mapa { type inet_service: ipv4_addr\;
>  timeout 5s\; }
> 
> Results in:
> 
> table ip nftlb {
> 	map mapa {
> 		type inet_service : ipv4_addr
> 		timeout 5s
> 	}
> }

Applied, thanks Laura.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arturo Borrero Gonzalez March 2, 2018, 11:59 a.m. UTC | #2
On 2 March 2018 at 11:47, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Fri, Mar 02, 2018 at 10:50:18AM +0100, Laura Garcia Liebana wrote:
>> Support of key and value association with a certain timeout.
>>
>> Example:
>>
>> nft add map nftlb mapa { type inet_service: ipv4_addr\;
>>  timeout 5s\; }
>>
>> Results in:
>>
>> table ip nftlb {
>>       map mapa {
>>               type inet_service : ipv4_addr
>>               timeout 5s
>>       }
>> }
>
> Applied, thanks Laura.

Good work. @Laura could we have testcases for this?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/src/parser_bison.y b/src/parser_bison.y
index df672b1..0c9e6c2 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1462,6 +1462,11 @@  map_block_alloc		:	/* empty */
 map_block		:	/* empty */	{ $$ = $<set>-1; }
 			|	map_block	common_block
 			|	map_block	stmt_separator
+			|	map_block	TIMEOUT		time_spec	stmt_separator
+			{
+				$1->timeout = $3 * 1000;
+				$$ = $1;
+			}
 			|	map_block	TYPE
 						data_type_expr	COLON	data_type_expr
 						stmt_separator