summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-21 12:14:17 +0100
committerDavid S. Miller <davem@davemloft.net>2008-03-21 12:14:17 +0100
commit0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f (patch)
tree9add3d8686b41aa3022b49d9cc57710865245e26
parent[NETNS][IPV4] tcp - make proc handle the network namespaces (diff)
downloadlinux-0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f.tar.xz
linux-0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f.zip
[NETNS][IPV6] udp6 - make proc per namespace
The proc init/exit functions take a new network namespace parameter in order to register/unregister /proc/net/udp6 for a 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/udp.h4
-rw-r--r--net/ipv4/udp.c12
-rw-r--r--net/ipv4/udplite.c2
-rw-r--r--net/ipv6/af_inet6.c19
-rw-r--r--net/ipv6/udp.c8
-rw-r--r--net/ipv6/udplite.c4
7 files changed, 29 insertions, 24 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8db06af1efbb..e01a563132e8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -597,8 +597,8 @@ 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 udp6_proc_init(void);
-extern void udp6_proc_exit(void);
+extern int udp6_proc_init(struct net *net);
+extern void udp6_proc_exit(struct net *net);
extern int udplite6_proc_init(void);
extern void udplite6_proc_exit(void);
extern int ipv6_misc_proc_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index a1b33d667199..b4cbdce883d1 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -200,8 +200,8 @@ struct udp_iter_state {
};
#ifdef CONFIG_PROC_FS
-extern int udp_proc_register(struct udp_seq_afinfo *afinfo);
-extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo);
+extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
+extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
extern int udp4_proc_init(void);
extern void udp4_proc_exit(void);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 049e92519616..a98c43c0a89c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1632,7 +1632,7 @@ static int udp_seq_release(struct inode *inode, struct file *file)
}
/* ------------------------------------------------------------------------ */
-int udp_proc_register(struct udp_seq_afinfo *afinfo)
+int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
{
struct proc_dir_entry *p;
int rc = 0;
@@ -1645,7 +1645,7 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
afinfo->seq_fops->llseek = seq_lseek;
afinfo->seq_fops->release = udp_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
@@ -1653,11 +1653,11 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
return rc;
}
-void udp_proc_unregister(struct udp_seq_afinfo *afinfo)
+void udp_proc_unregister(struct net *net, struct udp_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));
}
@@ -1709,12 +1709,12 @@ static struct udp_seq_afinfo udp4_seq_afinfo = {
int __init udp4_proc_init(void)
{
- return udp_proc_register(&udp4_seq_afinfo);
+ return udp_proc_register(&init_net, &udp4_seq_afinfo);
}
void udp4_proc_exit(void)
{
- udp_proc_unregister(&udp4_seq_afinfo);
+ udp_proc_unregister(&init_net, &udp4_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index d49c6d68c8a9..2469b5104587 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -105,7 +105,7 @@ void __init udplite4_register(void)
inet_register_protosw(&udplite4_protosw);
#ifdef CONFIG_PROC_FS
- if (udp_proc_register(&udplite4_seq_afinfo)) /* udplite4_proc_init() */
+ if (udp_proc_register(&init_net, &udplite4_seq_afinfo))
printk(KERN_ERR "%s: Cannot register /proc!\n", __func__);
#endif
return;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 730a861b8f41..e3e09147d134 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -842,6 +842,8 @@ static void cleanup_ipv6_mibs(void)
static int inet6_net_init(struct net *net)
{
+ int err = 0;
+
net->ipv6.sysctl.bindv6only = 0;
net->ipv6.sysctl.flush_delay = 0;
net->ipv6.sysctl.ip6_rt_max_size = 4096;
@@ -853,12 +855,20 @@ static int inet6_net_init(struct net *net)
net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
net->ipv6.sysctl.icmpv6_time = 1*HZ;
- return 0;
+#ifdef CONFIG_PROC_FS
+ err = udp6_proc_init(net);
+ if (err)
+ goto out;
+out:
+#endif
+ return err;
}
static void inet6_net_exit(struct net *net)
{
- return;
+#ifdef CONFIG_PROC_FS
+ udp6_proc_exit(net);
+#endif
}
static struct pernet_operations inet6_net_ops = {
@@ -943,8 +953,6 @@ static int __init inet6_init(void)
goto proc_raw6_fail;
if (tcp6_proc_init())
goto proc_tcp6_fail;
- if (udp6_proc_init())
- goto proc_udp6_fail;
if (udplite6_proc_init())
goto proc_udplite6_fail;
if (ipv6_misc_proc_init())
@@ -1029,8 +1037,6 @@ proc_anycast6_fail:
proc_misc6_fail:
udplite6_proc_exit();
proc_udplite6_fail:
- udp6_proc_exit();
-proc_udp6_fail:
tcp6_proc_exit();
proc_tcp6_fail:
raw6_proc_exit();
@@ -1092,7 +1098,6 @@ static void __exit inet6_exit(void)
ac6_proc_exit();
ipv6_misc_proc_exit();
udplite6_proc_exit();
- udp6_proc_exit();
tcp6_proc_exit();
raw6_proc_exit();
#endif
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d6e311f6c8eb..af619d48ba80 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -989,13 +989,13 @@ static struct udp_seq_afinfo udp6_seq_afinfo = {
.seq_fops = &udp6_seq_fops,
};
-int __init udp6_proc_init(void)
+int udp6_proc_init(struct net *net)
{
- return udp_proc_register(&udp6_seq_afinfo);
+ return udp_proc_register(net, &udp6_seq_afinfo);
}
-void udp6_proc_exit(void) {
- udp_proc_unregister(&udp6_seq_afinfo);
+void udp6_proc_exit(struct net *net) {
+ udp_proc_unregister(net, &udp6_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 87d4202522ee..815190be528c 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -115,11 +115,11 @@ static struct udp_seq_afinfo udplite6_seq_afinfo = {
int __init udplite6_proc_init(void)
{
- return udp_proc_register(&udplite6_seq_afinfo);
+ return udp_proc_register(&init_net, &udplite6_seq_afinfo);
}
void udplite6_proc_exit(void)
{
- udp_proc_unregister(&udplite6_seq_afinfo);
+ udp_proc_unregister(&init_net, &udplite6_seq_afinfo);
}
#endif