Ran into getting a different default value applied for `bucketsize` as documented in the man page, i.e., 12 vs. 14, for example: `create foo hash:net family inet hashsize 64 maxelem 64` ipset save tells me: `create foo hash:net family inet hashsize 64 maxelem 64 bucketsize 12 initval 0xd4f64074` But the man page states: > Possible values are any even number between 2-14 and the default is 14. In the kernel code the `AHASH_MAX_SIZE`, which was used to bound check any value coming from user space and acts also as default, was defined to `2 * 6` = 12, it almost seems like it was inteded to define the span of valid values (2 - 14 = 12 after all) but then used as actual upper bound everywhere, so it was lost that the range starts on 2, not zero. Either one should be fixed and I went for the code, seems nicer to have a bigger tuning range, the docs are quite explicit and the commit ccf0a4b7fc68 ("netfilter: ipset: Add bucketsize parameter to all hash types")' that introduced the change on the kernelside doesn't mentions any range/default values at all. So I just added the AHASH_INIT_SIZE and checked all use sites of `AHASH_MAX_SIZE`, but those sites basically are only the range checks anyway. Signed-off-by: Thomas Lamprecht <t.lamprecht@xxxxxxxxxxx> --- sending as RFC as one could still go for the docs fix instead and because I'm not to versed with the whole netfilter code base, so may overlook something. net/netfilter/ipset/ip_set_hash_gen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 6e391308431d..8bc6c46403de 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b/net/netfilter/ipset/ip_set_hash_gen.h @@ -39,7 +39,7 @@ /* Number of elements to store in an initial array block */ #define AHASH_INIT_SIZE 2 /* Max number of elements to store in an array block */ -#define AHASH_MAX_SIZE (6 * AHASH_INIT_SIZE) +#define AHASH_MAX_SIZE (AHASH_INIT_SIZE + 6 * AHASH_INIT_SIZE) /* Max muber of elements in the array block when tuned */ #define AHASH_MAX_TUNED 64 -- 2.30.2