aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-21 07:14:45 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-21 07:14:45 -0400
commit6f8b13bcb3369a5df2e63acc422bed6098f5b8c4 (patch)
tree715d53b85e86b26c113b417e269602d1cb8ca436
parent0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f (diff)
[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);
595extern void ac6_proc_exit(void); 595extern void ac6_proc_exit(void);
596extern int raw6_proc_init(void); 596extern int raw6_proc_init(void);
597extern void raw6_proc_exit(void); 597extern void raw6_proc_exit(void);
598extern int tcp6_proc_init(void); 598extern int tcp6_proc_init(struct net *net);
599extern void tcp6_proc_exit(void); 599extern void tcp6_proc_exit(struct net *net);
600extern int udp6_proc_init(struct net *net); 600extern int udp6_proc_init(struct net *net);
601extern void udp6_proc_exit(struct net *net); 601extern void udp6_proc_exit(struct net *net);
602extern int udplite6_proc_init(void); 602extern 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 {
1336 struct seq_operations seq_ops; 1336 struct seq_operations seq_ops;
1337}; 1337};
1338 1338
1339extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); 1339extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
1340extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); 1340extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1341 1341
1342extern struct request_sock_ops tcp_request_sock_ops; 1342extern struct request_sock_ops tcp_request_sock_ops;
1343extern struct request_sock_ops tcp6_request_sock_ops; 1343extern 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)
2253 return 0; 2253 return 0;
2254} 2254}
2255 2255
2256int tcp_proc_register(struct tcp_seq_afinfo *afinfo) 2256int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
2257{ 2257{
2258 int rc = 0; 2258 int rc = 0;
2259 struct proc_dir_entry *p; 2259 struct proc_dir_entry *p;
@@ -2266,7 +2266,7 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
2266 afinfo->seq_fops->llseek = seq_lseek; 2266 afinfo->seq_fops->llseek = seq_lseek;
2267 afinfo->seq_fops->release = tcp_seq_release; 2267 afinfo->seq_fops->release = tcp_seq_release;
2268 2268
2269 p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops); 2269 p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
2270 if (p) 2270 if (p)
2271 p->data = afinfo; 2271 p->data = afinfo;
2272 else 2272 else
@@ -2274,11 +2274,11 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
2274 return rc; 2274 return rc;
2275} 2275}
2276 2276
2277void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo) 2277void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
2278{ 2278{
2279 if (!afinfo) 2279 if (!afinfo)
2280 return; 2280 return;
2281 proc_net_remove(&init_net, afinfo->name); 2281 proc_net_remove(net, afinfo->name);
2282 memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops)); 2282 memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
2283} 2283}
2284 2284
@@ -2419,12 +2419,12 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
2419 2419
2420int __init tcp4_proc_init(void) 2420int __init tcp4_proc_init(void)
2421{ 2421{
2422 return tcp_proc_register(&tcp4_seq_afinfo); 2422 return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
2423} 2423}
2424 2424
2425void tcp4_proc_exit(void) 2425void tcp4_proc_exit(void)
2426{ 2426{
2427 tcp_proc_unregister(&tcp4_seq_afinfo); 2427 tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
2428} 2428}
2429#endif /* CONFIG_PROC_FS */ 2429#endif /* CONFIG_PROC_FS */
2430 2430
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)
859 err = udp6_proc_init(net); 859 err = udp6_proc_init(net);
860 if (err) 860 if (err)
861 goto out; 861 goto out;
862 err = tcp6_proc_init(net);
863 if (err)
864 goto proc_tcp6_fail;
862out: 865out:
863#endif 866#endif
864 return err; 867 return err;
868
869#ifdef CONFIG_PROC_FS
870proc_tcp6_fail:
871 udp6_proc_exit(net);
872 goto out;
873#endif
865} 874}
866 875
867static void inet6_net_exit(struct net *net) 876static void inet6_net_exit(struct net *net)
868{ 877{
869#ifdef CONFIG_PROC_FS 878#ifdef CONFIG_PROC_FS
870 udp6_proc_exit(net); 879 udp6_proc_exit(net);
880 tcp6_proc_exit(net);
871#endif 881#endif
872} 882}
873 883
@@ -951,8 +961,6 @@ static int __init inet6_init(void)
951 err = -ENOMEM; 961 err = -ENOMEM;
952 if (raw6_proc_init()) 962 if (raw6_proc_init())
953 goto proc_raw6_fail; 963 goto proc_raw6_fail;
954 if (tcp6_proc_init())
955 goto proc_tcp6_fail;
956 if (udplite6_proc_init()) 964 if (udplite6_proc_init())
957 goto proc_udplite6_fail; 965 goto proc_udplite6_fail;
958 if (ipv6_misc_proc_init()) 966 if (ipv6_misc_proc_init())
@@ -1037,8 +1045,6 @@ proc_anycast6_fail:
1037proc_misc6_fail: 1045proc_misc6_fail:
1038 udplite6_proc_exit(); 1046 udplite6_proc_exit();
1039proc_udplite6_fail: 1047proc_udplite6_fail:
1040 tcp6_proc_exit();
1041proc_tcp6_fail:
1042 raw6_proc_exit(); 1048 raw6_proc_exit();
1043proc_raw6_fail: 1049proc_raw6_fail:
1044#endif 1050#endif
@@ -1098,7 +1104,6 @@ static void __exit inet6_exit(void)
1098 ac6_proc_exit(); 1104 ac6_proc_exit();
1099 ipv6_misc_proc_exit(); 1105 ipv6_misc_proc_exit();
1100 udplite6_proc_exit(); 1106 udplite6_proc_exit();
1101 tcp6_proc_exit();
1102 raw6_proc_exit(); 1107 raw6_proc_exit();
1103#endif 1108#endif
1104 ipv6_netfilter_fini(); 1109 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 = {
2129 .seq_fops = &tcp6_seq_fops, 2129 .seq_fops = &tcp6_seq_fops,
2130}; 2130};
2131 2131
2132int __init tcp6_proc_init(void) 2132int tcp6_proc_init(struct net *net)
2133{ 2133{
2134 return tcp_proc_register(&tcp6_seq_afinfo); 2134 return tcp_proc_register(net, &tcp6_seq_afinfo);
2135} 2135}
2136 2136
2137void tcp6_proc_exit(void) 2137void tcp6_proc_exit(struct net *net)
2138{ 2138{
2139 tcp_proc_unregister(&tcp6_seq_afinfo); 2139 tcp_proc_unregister(net, &tcp6_seq_afinfo);
2140} 2140}
2141#endif 2141#endif
2142 2142