summaryrefslogtreecommitdiffstats
path: root/src/mnl.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-12-10 22:08:44 +0100
committerFlorian Westphal <fw@strlen.de>2019-12-17 23:10:46 +0100
commit6a0fb05cc335350c92738a88d7434514ab4548cb (patch)
treea4ea36999cc37ed543ff2cf89141ada168ec44aa /src/mnl.c
parent24547258d25cde9256033d1056cf4a9b7a1465dd (diff)
mnl: round up the map data size too
Same as key: if the size isn't divisible by BITS_PER_BYTE, we need to round up, not down. Without this, you can't store vlan ids in a map, as they are truncated to 8 bit. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/mnl.c')
-rw-r--r--src/mnl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mnl.c b/src/mnl.c
index 03afe79c..d5bdff29 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -861,7 +861,7 @@ int mnl_nft_set_add(struct netlink_ctx *ctx, const struct cmd *cmd,
nftnl_set_set_u32(nls, NFTNL_SET_DATA_TYPE,
dtype_map_to_kernel(set->data->dtype));
nftnl_set_set_u32(nls, NFTNL_SET_DATA_LEN,
- set->data->len / BITS_PER_BYTE);
+ div_round_up(set->data->len, BITS_PER_BYTE));
}
if (set_is_objmap(set->flags))
nftnl_set_set_u32(nls, NFTNL_SET_OBJ_TYPE, set->objtype);