aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-08 05:35:06 -0400
committerPatrick McHardy <kaber@trash.net>2008-10-08 05:35:06 -0400
commitdc5129f8df7cc3f2f04b322728d71c42795d34cc (patch)
treedada1084b822005d267d02dfb4a70266b9294cdc
parentb2ce2c7479d9b60dd268203e56bb738e78fd5fda (diff)
netfilter: netns nf_conntrack: per-netns /proc/net/nf_conntrack_expect
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--net/netfilter/nf_conntrack_expect.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 5307316356ea..6a09200049ee 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -423,12 +423,13 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_related);
423 423
424#ifdef CONFIG_PROC_FS 424#ifdef CONFIG_PROC_FS
425struct ct_expect_iter_state { 425struct ct_expect_iter_state {
426 struct seq_net_private p;
426 unsigned int bucket; 427 unsigned int bucket;
427}; 428};
428 429
429static struct hlist_node *ct_expect_get_first(struct seq_file *seq) 430static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
430{ 431{
431 struct net *net = &init_net; 432 struct net *net = seq_file_net(seq);
432 struct ct_expect_iter_state *st = seq->private; 433 struct ct_expect_iter_state *st = seq->private;
433 struct hlist_node *n; 434 struct hlist_node *n;
434 435
@@ -443,7 +444,7 @@ static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
443static struct hlist_node *ct_expect_get_next(struct seq_file *seq, 444static struct hlist_node *ct_expect_get_next(struct seq_file *seq,
444 struct hlist_node *head) 445 struct hlist_node *head)
445{ 446{
446 struct net *net = &init_net; 447 struct net *net = seq_file_net(seq);
447 struct ct_expect_iter_state *st = seq->private; 448 struct ct_expect_iter_state *st = seq->private;
448 449
449 head = rcu_dereference(head->next); 450 head = rcu_dereference(head->next);
@@ -524,7 +525,7 @@ static const struct seq_operations exp_seq_ops = {
524 525
525static int exp_open(struct inode *inode, struct file *file) 526static int exp_open(struct inode *inode, struct file *file)
526{ 527{
527 return seq_open_private(file, &exp_seq_ops, 528 return seq_open_net(inode, file, &exp_seq_ops,
528 sizeof(struct ct_expect_iter_state)); 529 sizeof(struct ct_expect_iter_state));
529} 530}
530 531
@@ -533,26 +534,26 @@ static const struct file_operations exp_file_ops = {
533 .open = exp_open, 534 .open = exp_open,
534 .read = seq_read, 535 .read = seq_read,
535 .llseek = seq_lseek, 536 .llseek = seq_lseek,
536 .release = seq_release_private, 537 .release = seq_release_net,
537}; 538};
538#endif /* CONFIG_PROC_FS */ 539#endif /* CONFIG_PROC_FS */
539 540
540static int exp_proc_init(void) 541static int exp_proc_init(struct net *net)
541{ 542{
542#ifdef CONFIG_PROC_FS 543#ifdef CONFIG_PROC_FS
543 struct proc_dir_entry *proc; 544 struct proc_dir_entry *proc;
544 545
545 proc = proc_net_fops_create(&init_net, "nf_conntrack_expect", 0440, &exp_file_ops); 546 proc = proc_net_fops_create(net, "nf_conntrack_expect", 0440, &exp_file_ops);
546 if (!proc) 547 if (!proc)
547 return -ENOMEM; 548 return -ENOMEM;
548#endif /* CONFIG_PROC_FS */ 549#endif /* CONFIG_PROC_FS */
549 return 0; 550 return 0;
550} 551}
551 552
552static void exp_proc_remove(void) 553static void exp_proc_remove(struct net *net)
553{ 554{
554#ifdef CONFIG_PROC_FS 555#ifdef CONFIG_PROC_FS
555 proc_net_remove(&init_net, "nf_conntrack_expect"); 556 proc_net_remove(net, "nf_conntrack_expect");
556#endif /* CONFIG_PROC_FS */ 557#endif /* CONFIG_PROC_FS */
557} 558}
558 559
@@ -581,7 +582,7 @@ int nf_conntrack_expect_init(struct net *net)
581 if (!nf_ct_expect_cachep) 582 if (!nf_ct_expect_cachep)
582 goto err2; 583 goto err2;
583 584
584 err = exp_proc_init(); 585 err = exp_proc_init(net);
585 if (err < 0) 586 if (err < 0)
586 goto err3; 587 goto err3;
587 588
@@ -598,7 +599,7 @@ err1:
598 599
599void nf_conntrack_expect_fini(struct net *net) 600void nf_conntrack_expect_fini(struct net *net)
600{ 601{
601 exp_proc_remove(); 602 exp_proc_remove(net);
602 kmem_cache_destroy(nf_ct_expect_cachep); 603 kmem_cache_destroy(nf_ct_expect_cachep);
603 nf_ct_free_hashtable(net->ct.expect_hash, net->ct.expect_vmalloc, 604 nf_ct_free_hashtable(net->ct.expect_hash, net->ct.expect_vmalloc,
604 nf_ct_expect_hsize); 605 nf_ct_expect_hsize);