summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-07-11 15:49:09 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-07-16 19:53:43 +0200
commit7d3c01182e883e18050903b9176593c517e4ff91 (patch)
tree2cc24b204177e2192bbd6be3e8f2b8e5bd27c6d7 /include
parent0fd53234e360d4dde8aa53dbcaad89495a4fab7f (diff)
evaluate: missing object maps handling in list and flush commands
NFT_SET_OBJECT tells there is an object map. # nft list ruleset table inet filter { map countermap { type ipv4_addr : counter } } The following command fails: # nft flush set inet filter countermap This patch checks for NFT_SET_OBJECT from new set_is_literal() and map_is_literal() functions. This patch also adds tests for this. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/rule.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/rule.h b/include/rule.h
index bee1d447..42d29b7c 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -337,6 +337,21 @@ static inline bool set_is_map(uint32_t set_flags)
return set_is_datamap(set_flags) || set_is_objmap(set_flags);
}
+static inline bool set_is_anonymous(uint32_t set_flags)
+{
+ return set_flags & NFT_SET_ANONYMOUS;
+}
+
+static inline bool set_is_literal(uint32_t set_flags)
+{
+ return !(set_is_anonymous(set_flags) || set_is_map(set_flags));
+}
+
+static inline bool map_is_literal(uint32_t set_flags)
+{
+ return !(set_is_anonymous(set_flags) || !set_is_map(set_flags));
+}
+
#include <statement.h>
struct counter {