]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_bison: Allow flushing maps
authorElise Lennion <elise.lennion@gmail.com>
Fri, 17 Mar 2017 15:04:06 +0000 (12:04 -0300)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 20 Mar 2017 10:17:23 +0000 (11:17 +0100)
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.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
doc/nft.xml
src/parser_bison.y

index d41218460913555b4fa1453d98b246bf3714d619..5b75469077df603316d1b11489439213bb418b5e 100644 (file)
@@ -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">
index e44ff44d761c7cbec3d8ac0ae2341186f44dfb5c..841b2e17b1c7edcd87fc32b2c5859fa8fd700be7 100644 (file)
@@ -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);