[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>
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 730a861..e3e0914 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -842,6 +842,8 @@
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 @@
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 @@
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_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 @@
ac6_proc_exit();
ipv6_misc_proc_exit();
udplite6_proc_exit();
- udp6_proc_exit();
tcp6_proc_exit();
raw6_proc_exit();
#endif