conntrackd: set default hashtable buckets and max entries if not specified
Pablo Neira Ayuso
maintainerPATCH 1/1 conntrackd: set default hashtable buckets and max entries if not specified
Fall back to 65536 buckets and 262144 entries.
It would be probably good to add code to autoadjust by reading /proc/sys/net/netfilter/nf_conntrack_buckets and /proc/sys/net/nf_conntrack_max.
--- src/read_config_yy.y | 6 ++++++ 1 file changed, 6 insertions(+)
src/read_config_yy.y +6 -0
@@ -1780,5 +1780,11 @@ init_config(char *filename) NF_NETLINK_CONNTRACK_DESTROY; } + /* default hashtable buckets and maximum number of entries */ + if (!CONFIG(hashsize)) + CONFIG(hashsize) = 65536; + if (!CONFIG(limit)) + CONFIG(limit) = 262144; + return 0; }
Signature · 1 line
2.20.1
Quoted 6 lines · Pablo Neira Ayuso
Fall back to 65536 buckets and 262144 entries.
It would be probably good to add code to autoadjust by reading
/proc/sys/net/netfilter/nf_conntrack_bucketsand/proc/sys/net/nf_conntrack_max.
Quoted 6 lines
Signed-off-by Pablo Neira Ayuso <[email protected]>--- src/read_config_yy.y | 6 ++++++ 1 file changed, 6 insertions(+)
Thanks for the patch!
Would it make sense to have all this logic in evaluate() in src/run.c?
Pablo Neira Ayuso
maintainerQuoted 14 lines · Arturo Borrero Gonzalez
Quoted 6 lines · Pablo Neira Ayuso
Fall back to 65536 buckets and 262144 entries.
It would be probably good to add code to autoadjust by reading
/proc/sys/net/netfilter/nf_conntrack_bucketsand/proc/sys/net/nf_conntrack_max.Quoted 6 lines
Signed-off-by Pablo Neira Ayuso <[email protected]>--- src/read_config_yy.y | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 3 lines
Thanks for the patch!
Would it make sense to have all this logic in
evaluate()insrc/run.c?
I think so. A patch to move it there would be fine.
I suspect there might more missing sanity checks in the configuration file parser (options that are not set to default value, like hashsize and hashlimit).