diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-07-15 08:26:43 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-07-16 19:53:43 +0200 |
commit | 0fd53234e360d4dde8aa53dbcaad89495a4fab7f (patch) | |
tree | 8b8626a93e422f8d107a689c39407d15c91cb5e0 /src/rule.c | |
parent | 28f22b78f7738a66f88089ecab135242c4c9156d (diff) |
src: add set_is_datamap(), set_is_objmap() and set_is_map() helpers
Two map types are currently possible:
* data maps, ie. set_is_datamap().
* object maps, ie. set_is_objmap().
This patch adds helper functions to check for the map type.
set_is_map() allows you to check for either map type.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -449,7 +449,7 @@ static void set_print_declaration(const struct set *set, if ((set->flags & (NFT_SET_EVAL | NFT_SET_ANONYMOUS)) == (NFT_SET_EVAL | NFT_SET_ANONYMOUS)) type = "meter"; - else if (set->flags & (NFT_SET_MAP | NFT_SET_OBJECT)) + else if (set_is_map(set->flags)) type = "map"; else type = "set"; @@ -469,9 +469,9 @@ static void set_print_declaration(const struct set *set, nft_print(octx, "%s", opts->nl); nft_print(octx, "%s%stype %s", opts->tab, opts->tab, set->key->dtype->name); - if (set->flags & NFT_SET_MAP) + if (set_is_datamap(set->flags)) nft_print(octx, " : %s", set->datatype->name); - else if (set->flags & NFT_SET_OBJECT) + else if (set_is_objmap(set->flags)) nft_print(octx, " : %s", obj_type_name(set->objtype)); nft_print(octx, "%s", opts->stmt_separator); |