diff options
author | Patrick McHardy <kaber@trash.net> | 2010-02-08 14:18:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-08 14:18:07 -0500 |
commit | d696c7bdaa55e2208e56c6f98e6bc1599f34286d (patch) | |
tree | 628782197c21b1e8611a41914865cdba586a1c65 /include | |
parent | 14c7dbe043d01a83a30633ab6b109ba2ac61d9f7 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netns/conntrack.h | 1 | ||||
-rw-r--r-- | include/net/netns/ipv4.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index aed23b6c8478..63d449807d9b 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
@@ -11,6 +11,7 @@ struct nf_conntrack_ecache; | |||
11 | struct netns_ct { | 11 | struct netns_ct { |
12 | atomic_t count; | 12 | atomic_t count; |
13 | unsigned int expect_count; | 13 | unsigned int expect_count; |
14 | unsigned int htable_size; | ||
14 | struct kmem_cache *nf_conntrack_cachep; | 15 | struct kmem_cache *nf_conntrack_cachep; |
15 | struct hlist_nulls_head *hash; | 16 | struct hlist_nulls_head *hash; |
16 | struct hlist_head *expect_hash; | 17 | struct hlist_head *expect_hash; |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2eb3814d6258..9a4b8b714079 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -40,6 +40,7 @@ struct netns_ipv4 { | |||
40 | struct xt_table *iptable_security; | 40 | struct xt_table *iptable_security; |
41 | struct xt_table *nat_table; | 41 | struct xt_table *nat_table; |
42 | struct hlist_head *nat_bysource; | 42 | struct hlist_head *nat_bysource; |
43 | unsigned int nat_htable_size; | ||
43 | int nat_vmalloced; | 44 | int nat_vmalloced; |
44 | #endif | 45 | #endif |
45 | 46 | ||