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/mnl.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/mnl.c')
-rw-r--r-- | src/mnl.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -799,13 +799,13 @@ int mnl_nft_set_add(struct netlink_ctx *ctx, const struct cmd *cmd, dtype_map_to_kernel(set->key->dtype)); nftnl_set_set_u32(nls, NFTNL_SET_KEY_LEN, div_round_up(set->key->len, BITS_PER_BYTE)); - if (set->flags & NFT_SET_MAP) { + if (set_is_datamap(set->flags)) { nftnl_set_set_u32(nls, NFTNL_SET_DATA_TYPE, dtype_map_to_kernel(set->datatype)); nftnl_set_set_u32(nls, NFTNL_SET_DATA_LEN, set->datalen / BITS_PER_BYTE); } - if (set->flags & NFT_SET_OBJECT) + if (set_is_objmap(set->flags)) nftnl_set_set_u32(nls, NFTNL_SET_OBJ_TYPE, set->objtype); if (set->timeout) @@ -833,7 +833,7 @@ int mnl_nft_set_add(struct netlink_ctx *ctx, const struct cmd *cmd, set->key->byteorder)) memory_allocation_error(); - if (set->flags & NFT_SET_MAP && + if (set_is_datamap(set->flags) && !nftnl_udata_put_u32(udbuf, NFTNL_UDATA_SET_DATABYTEORDER, set->datatype->byteorder)) memory_allocation_error(); |