netfilter: netns nf_conntrack: per-netns expectations
Make per-netns a) expectation hash and b) expectations count. Expectations always belongs to netns to which it's master conntrack belong. This is natural and doesn't bloat expectation. Proc files and leaf users are stubbed to init_net, this is temporary. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
committed by
Patrick McHardy
parent
b21f890193
commit
9b03f38d04
@ -177,11 +177,12 @@ struct ct_expect_iter_state {
|
||||
|
||||
static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
|
||||
{
|
||||
struct net *net = &init_net;
|
||||
struct ct_expect_iter_state *st = seq->private;
|
||||
struct hlist_node *n;
|
||||
|
||||
for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) {
|
||||
n = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
|
||||
n = rcu_dereference(net->ct.expect_hash[st->bucket].first);
|
||||
if (n)
|
||||
return n;
|
||||
}
|
||||
@ -191,13 +192,14 @@ static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
|
||||
static struct hlist_node *ct_expect_get_next(struct seq_file *seq,
|
||||
struct hlist_node *head)
|
||||
{
|
||||
struct net *net = &init_net;
|
||||
struct ct_expect_iter_state *st = seq->private;
|
||||
|
||||
head = rcu_dereference(head->next);
|
||||
while (head == NULL) {
|
||||
if (++st->bucket >= nf_ct_expect_hsize)
|
||||
return NULL;
|
||||
head = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
|
||||
head = rcu_dereference(net->ct.expect_hash[st->bucket].first);
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static void pptp_nat_expected(struct nf_conn *ct,
|
||||
|
||||
pr_debug("trying to unexpect other dir: ");
|
||||
nf_ct_dump_tuple_ip(&t);
|
||||
other_exp = nf_ct_expect_find_get(&t);
|
||||
other_exp = nf_ct_expect_find_get(&init_net, &t);
|
||||
if (other_exp) {
|
||||
nf_ct_unexpect_related(other_exp);
|
||||
nf_ct_expect_put(other_exp);
|
||||
|
Reference in New Issue
Block a user