summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-21 12:14:45 +0100
committerDavid S. Miller <davem@davemloft.net>2008-03-21 12:14:45 +0100
commit6f8b13bcb3369a5df2e63acc422bed6098f5b8c4 (patch)
tree715d53b85e86b26c113b417e269602d1cb8ca436
parent[NETNS][IPV6] udp6 - make proc per namespace (diff)
downloadlinux-6f8b13bcb3369a5df2e63acc422bed6098f5b8c4.tar.xz
linux-6f8b13bcb3369a5df2e63acc422bed6098f5b8c4.zip
[NETNS][IPV6] tcp6 - make proc per namespace
Make the proc for tcp6 to be per namespace. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/tcp.h4
-rw-r--r--net/ipv4/tcp_ipv4.c12
-rw-r--r--net/ipv6/af_inet6.c15
-rw-r--r--net/ipv6/tcp_ipv6.c8
5 files changed, 24 insertions, 19 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e01a563132e8..e82f1814d96b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -595,8 +595,8 @@ extern int ac6_proc_init(void);
extern void ac6_proc_exit(void);
extern int raw6_proc_init(void);
extern void raw6_proc_exit(void);
-extern int tcp6_proc_init(void);
-extern void tcp6_proc_exit(void);
+extern int tcp6_proc_init(struct net *net);
+extern void tcp6_proc_exit(struct net *net);
extern int udp6_proc_init(struct net *net);
extern void udp6_proc_exit(struct net *net);
extern int udplite6_proc_init(void);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6b08dab1b1fa..847e1634e1f4 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1336,8 +1336,8 @@ struct tcp_iter_state {
struct seq_operations seq_ops;
};
-extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo);
-extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo);
+extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
+extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
extern struct request_sock_ops tcp_request_sock_ops;
extern struct request_sock_ops tcp6_request_sock_ops;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index f9b30dc3bd6c..744bc9d6cebc 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2253,7 +2253,7 @@ static int tcp_seq_release(struct inode *inode, struct file *file)
return 0;
}
-int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
+int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
{
int rc = 0;
struct proc_dir_entry *p;
@@ -2266,7 +2266,7 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
afinfo->seq_fops->llseek = seq_lseek;
afinfo->seq_fops->release = tcp_seq_release;
- p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
+ p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p)
p->data = afinfo;
else
@@ -2274,11 +2274,11 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
return rc;
}
-void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
+void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
{
if (!afinfo)
return;
- proc_net_remove(&init_net, afinfo->name);
+ proc_net_remove(net, afinfo->name);
memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
}
@@ -2419,12 +2419,12 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
int __init tcp4_proc_init(void)
{
- return tcp_proc_register(&tcp4_seq_afinfo);
+ return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
}
void tcp4_proc_exit(void)
{
- tcp_proc_unregister(&tcp4_seq_afinfo);
+ tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index e3e09147d134..f52bdaed8a1b 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -859,15 +859,25 @@ static int inet6_net_init(struct net *net)
err = udp6_proc_init(net);
if (err)
goto out;
+ err = tcp6_proc_init(net);
+ if (err)
+ goto proc_tcp6_fail;
out:
#endif
return err;
+
+#ifdef CONFIG_PROC_FS
+proc_tcp6_fail:
+ udp6_proc_exit(net);
+ goto out;
+#endif
}
static void inet6_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
udp6_proc_exit(net);
+ tcp6_proc_exit(net);
#endif
}
@@ -951,8 +961,6 @@ static int __init inet6_init(void)
err = -ENOMEM;
if (raw6_proc_init())
goto proc_raw6_fail;
- if (tcp6_proc_init())
- goto proc_tcp6_fail;
if (udplite6_proc_init())
goto proc_udplite6_fail;
if (ipv6_misc_proc_init())
@@ -1037,8 +1045,6 @@ proc_anycast6_fail:
proc_misc6_fail:
udplite6_proc_exit();
proc_udplite6_fail:
- tcp6_proc_exit();
-proc_tcp6_fail:
raw6_proc_exit();
proc_raw6_fail:
#endif
@@ -1098,7 +1104,6 @@ static void __exit inet6_exit(void)
ac6_proc_exit();
ipv6_misc_proc_exit();
udplite6_proc_exit();
- tcp6_proc_exit();
raw6_proc_exit();
#endif
ipv6_netfilter_fini();
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index caf0cc1c00e1..56d0cea7d578 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2129,14 +2129,14 @@ static struct tcp_seq_afinfo tcp6_seq_afinfo = {
.seq_fops = &tcp6_seq_fops,
};
-int __init tcp6_proc_init(void)
+int tcp6_proc_init(struct net *net)
{
- return tcp_proc_register(&tcp6_seq_afinfo);
+ return tcp_proc_register(net, &tcp6_seq_afinfo);
}
-void tcp6_proc_exit(void)
+void tcp6_proc_exit(struct net *net)
{
- tcp_proc_unregister(&tcp6_seq_afinfo);
+ tcp_proc_unregister(net, &tcp6_seq_afinfo);
}
#endif