]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_conntrack: fix hash resizing with namespaces
authorPatrick McHardy <kaber@trash.net>
Mon, 8 Feb 2010 19:18:07 +0000 (11:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Feb 2010 19:18:07 +0000 (11:18 -0800)
commit8bfb02192ced71c035d8b7ff0603166140380aaf
tree628782197c21b1e8611a41914865cdba586a1c65
parentf03c9ac0e1c643d4f41f2110aeb3bf613cda971f
netfilter: nf_conntrack: fix hash resizing with namespaces

As noticed by Jon Masters <jonathan@jonmasters.org>, the conntrack hash
size is global and not per namespace, but modifiable at runtime through
/sys/module/nf_conntrack/hashsize. Changing the hash size will only
resize the hash in the current namespace however, so other namespaces
will use an invalid hash size. This can cause crashes when enlarging
the hashsize, or false negative lookups when shrinking it.

Move the hash size into the per-namespace data and only use the global
hash size to initialize the per-namespace value when instanciating a
new namespace. Additionally restrict hash resizing to init_net for
now as other namespaces are not handled currently.

Cc: stable@kernel.org
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netns/conntrack.h
include/net/netns/ipv4.h
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/ipv4/netfilter/nf_nat_core.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_standalone.c