]> git.ipfire.org Git - people/arne_f/kernel.git/commit
netfilter: conntrack: fix reading nf_conntrack_buckets
authorJesper Dangaard Brouer <brouer@redhat.com>
Fri, 8 Jan 2021 11:44:33 +0000 (12:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:26:19 +0000 (18:26 +0100)
commit49fc6d92b484fd7cc75d62d6ee34f9f94a0507cc
tree8eef7c9e9f75edfc2a91753de0af06f6ae95c84e
parent548e4168e68dcd6346254b76de4ec16f556c1e1b
netfilter: conntrack: fix reading nf_conntrack_buckets

commit f6351c3f1c27c80535d76cac2299aec44c36291e upstream.

The old way of changing the conntrack hashsize runtime was through changing
the module param via file /sys/module/nf_conntrack/parameters/hashsize. This
was extended to sysctl change in commit 3183ab8997a4 ("netfilter: conntrack:
allow increasing bucket size via sysctl too").

The commit introduced second "user" variable nf_conntrack_htable_size_user
which shadow actual variable nf_conntrack_htable_size. When hashsize is
changed via module param this "user" variable isn't updated. This results in
sysctl net/netfilter/nf_conntrack_buckets shows the wrong value when users
update via the old way.

This patch fix the issue by always updating "user" variable when reading the
proc file. This will take care of changes to the actual variable without
sysctl need to be aware.

Fixes: 3183ab8997a4 ("netfilter: conntrack: allow increasing bucket size via sysctl too")
Reported-by: Yoel Caspersen <yoel@kviknet.dk>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_conntrack_standalone.c