]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 19 Feb 2021 15:45:04 +0000 (16:45 +0100)
commit2f0f2c6e1303790c1448533d0666c9d1acfafc25
tree29cbce5109f8c4f1697a459246b1243023227959
parentfdb0f98b4de5650adc3ae16296b43eaf4fc929b9
netfilter: conntrack: fix reading nf_conntrack_buckets

BugLink: https://bugs.launchpad.net/bugs/1914654
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
net/netfilter/nf_conntrack_standalone.c