From 7d3c01182e883e18050903b9176593c517e4ff91 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 11 Jul 2019 15:49:09 +0200 Subject: 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 --- include/rule.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') 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 struct counter { -- cgit v1.2.3