aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-08 05:35:04 -0400
committerPatrick McHardy <kaber@trash.net>2008-10-08 05:35:04 -0400
commit63c9a26264be108b52de087724673f8664570e34 (patch)
treec18fe6b396ce660f982e441c5a305d40d2d3b3d4 /net/netfilter
parent9b03f38d0487f3908696242286d934c9b38f9d2a (diff)
netfilter: netns nf_conntrack: per-netns unconfirmed list
What is confirmed connection in one netns can very well be unconfirmed in another one. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_core.c7
-rw-r--r--net/netfilter/nf_conntrack_helper.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index c188edea249..2a105db1330 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -54,7 +54,6 @@ struct nf_conn nf_conntrack_untracked __read_mostly;
54EXPORT_SYMBOL_GPL(nf_conntrack_untracked); 54EXPORT_SYMBOL_GPL(nf_conntrack_untracked);
55 55
56unsigned int nf_ct_log_invalid __read_mostly; 56unsigned int nf_ct_log_invalid __read_mostly;
57HLIST_HEAD(unconfirmed);
58static struct kmem_cache *nf_conntrack_cachep __read_mostly; 57static struct kmem_cache *nf_conntrack_cachep __read_mostly;
59 58
60DEFINE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat); 59DEFINE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
@@ -596,7 +595,8 @@ init_conntrack(struct net *net,
596 } 595 }
597 596
598 /* Overload tuple linked list to put us in unconfirmed list. */ 597 /* Overload tuple linked list to put us in unconfirmed list. */
599 hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode, &unconfirmed); 598 hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode,
599 &net->ct.unconfirmed);
600 600
601 spin_unlock_bh(&nf_conntrack_lock); 601 spin_unlock_bh(&nf_conntrack_lock);
602 602
@@ -957,7 +957,7 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
957 goto found; 957 goto found;
958 } 958 }
959 } 959 }
960 hlist_for_each_entry(h, n, &unconfirmed, hnode) { 960 hlist_for_each_entry(h, n, &net->ct.unconfirmed, hnode) {
961 ct = nf_ct_tuplehash_to_ctrack(h); 961 ct = nf_ct_tuplehash_to_ctrack(h);
962 if (iter(ct, data)) 962 if (iter(ct, data))
963 set_bit(IPS_DYING_BIT, &ct->status); 963 set_bit(IPS_DYING_BIT, &ct->status);
@@ -1154,6 +1154,7 @@ int nf_conntrack_init(struct net *net)
1154 printk(KERN_ERR "Unable to create nf_conntrack_hash\n"); 1154 printk(KERN_ERR "Unable to create nf_conntrack_hash\n");
1155 goto err_out; 1155 goto err_out;
1156 } 1156 }
1157 INIT_HLIST_HEAD(&net->ct.unconfirmed);
1157 1158
1158 nf_conntrack_max = max_factor * nf_conntrack_htable_size; 1159 nf_conntrack_max = max_factor * nf_conntrack_htable_size;
1159 1160
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index c793db810cd..920e778539a 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -156,7 +156,7 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
156 } 156 }
157 157
158 /* Get rid of expecteds, set helpers to NULL. */ 158 /* Get rid of expecteds, set helpers to NULL. */
159 hlist_for_each_entry(h, n, &unconfirmed, hnode) 159 hlist_for_each_entry(h, n, &init_net.ct.unconfirmed, hnode)
160 unhelp(h, me); 160 unhelp(h, me);
161 for (i = 0; i < nf_conntrack_htable_size; i++) { 161 for (i = 0; i < nf_conntrack_htable_size; i++) {
162 hlist_for_each_entry(h, n, &init_net.ct.hash[i], hnode) 162 hlist_for_each_entry(h, n, &init_net.ct.hash[i], hnode)