Skip to content

Commit

Permalink
netfilter: netns nf_conntrack: per-netns /proc/net/nf_conntrack_expect
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Alexey Dobriyan authored and Patrick McHardy committed Oct 8, 2008
1 parent b2ce2c7 commit dc5129f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions net/netfilter/nf_conntrack_expect.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,13 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_related);

#ifdef CONFIG_PROC_FS
struct ct_expect_iter_state {
struct seq_net_private p;
unsigned int bucket;
};

static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
{
struct net *net = &init_net;
struct net *net = seq_file_net(seq);
struct ct_expect_iter_state *st = seq->private;
struct hlist_node *n;

Expand All @@ -443,7 +444,7 @@ 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 net *net = seq_file_net(seq);
struct ct_expect_iter_state *st = seq->private;

head = rcu_dereference(head->next);
Expand Down Expand Up @@ -524,7 +525,7 @@ static const struct seq_operations exp_seq_ops = {

static int exp_open(struct inode *inode, struct file *file)
{
return seq_open_private(file, &exp_seq_ops,
return seq_open_net(inode, file, &exp_seq_ops,
sizeof(struct ct_expect_iter_state));
}

Expand All @@ -533,26 +534,26 @@ static const struct file_operations exp_file_ops = {
.open = exp_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
.release = seq_release_net,
};
#endif /* CONFIG_PROC_FS */

static int exp_proc_init(void)
static int exp_proc_init(struct net *net)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc;

proc = proc_net_fops_create(&init_net, "nf_conntrack_expect", 0440, &exp_file_ops);
proc = proc_net_fops_create(net, "nf_conntrack_expect", 0440, &exp_file_ops);
if (!proc)
return -ENOMEM;
#endif /* CONFIG_PROC_FS */
return 0;
}

static void exp_proc_remove(void)
static void exp_proc_remove(struct net *net)
{
#ifdef CONFIG_PROC_FS
proc_net_remove(&init_net, "nf_conntrack_expect");
proc_net_remove(net, "nf_conntrack_expect");
#endif /* CONFIG_PROC_FS */
}

Expand Down Expand Up @@ -581,7 +582,7 @@ int nf_conntrack_expect_init(struct net *net)
if (!nf_ct_expect_cachep)
goto err2;

err = exp_proc_init();
err = exp_proc_init(net);
if (err < 0)
goto err3;

Expand All @@ -598,7 +599,7 @@ int nf_conntrack_expect_init(struct net *net)

void nf_conntrack_expect_fini(struct net *net)
{
exp_proc_remove();
exp_proc_remove(net);
kmem_cache_destroy(nf_ct_expect_cachep);
nf_ct_free_hashtable(net->ct.expect_hash, net->ct.expect_vmalloc,
nf_ct_expect_hsize);
Expand Down

0 comments on commit dc5129f

Please sign in to comment.