Skip to contentSkip to conversation

parser_bison: Allow flushing maps

PATCH Applied Elise Lennion 2 participants 2 messages Mar 17, 2017 – Mar 20, 2017 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 parser_bison: Allow flushing maps

This patch enables the command flush on maps, which removes all entries in it:

$ nft flush map filter map1

Command above flushes map 'map1' in table 'filter'.

The documentation was updated accordingly.

---
 doc/nft.xml        | 9 +++++++++
 src/parser_bison.y | 4 ++++
 2 files changed, 13 insertions(+)
doc/nft.xml +9 -0
index b3e3d9e..a63b4c2 100644
@@ -812,6 +812,7 @@ filter input iif $int_ifs accept
 				<group choice="req">
 					<arg>delete</arg>
 					<arg>list</arg>
+					<arg>flush</arg>
 				</group>
 				<command> map</command>
 				<arg choice="opt"><replaceable>family</replaceable></arg>
@@ -848,6 +849,14 @@ filter input iif $int_ifs accept
 					</para>
 				</listitem>
 			</varlistentry>
+			<varlistentry>
+				<term><option>flush</option></term>
+				<listitem>
+					<para>
+						Remove all elements from the specified map.
+					</para>
+				</listitem>
+			</varlistentry>
 		</variablelist>
 
 		<table frame="all">
src/parser_bison.y +4 -0
index e44ff44..841b2e1 100644
@@ -1131,6 +1131,10 @@ flush_cmd		:	TABLE		table_spec
 			{
 				$$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_SET, &$3, &@$, NULL);
 			}
+			|	MAP		set_spec
+			{
+				$$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_SET, &$2, &@$, NULL);
+			}
 			|	RULESET		ruleset_spec
 			{
 				$$ = cmd_alloc(CMD_FLUSH, CMD_OBJ_RULESET, &$2, &@$, NULL);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Elise Lennion

This patch enables the command flush on maps, which removes all entries in it:

$ nft flush map filter map1

Command above flushes map 'map1' in table 'filter'.

The documentation was updated accordingly.

Also applied, thanks.