]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
mnl: do not send set size when set is constant set
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Jan 2025 16:41:01 +0000 (17:41 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 10 Jan 2025 10:21:02 +0000 (11:21 +0100)
When turning element range into the interval representation based on
singleton elements for the rbtree tree set backend, userspace adjusts
the size to the internal kernel implementation.

For constant sets, this is leaking an internal kernel implementation
detail that is fixed by kernel patch ("netfilter: nf_tables: fix set
size with rbtree backend"). For non-constant sets, set size is just
broken.

This patch is required by the follow up patch ("src: rework singleton
interval transformation to reduce memory consumption").

On top of this, constant sets cannot be updated once they are bound, set
size is not useful in this case. Remove this implicit set size for
constant sets.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/mnl.c

index 52085d6d960a27f5e912ae7bab607075514b5f50..5983fd468e56f2ba6d35a4a98c69c9008efe4e19 100644 (file)
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -1265,8 +1265,6 @@ int mnl_nft_set_add(struct netlink_ctx *ctx, struct cmd *cmd,
                if (set->desc.size != 0)
                        nftnl_set_set_u32(nls, NFTNL_SET_DESC_SIZE,
                                          set->desc.size);
-       } else if (set->init) {
-               nftnl_set_set_u32(nls, NFTNL_SET_DESC_SIZE, set->init->size);
        }
 
        udbuf = nftnl_udata_buf_alloc(NFT_USERDATA_MAXLEN);