aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sysctl_net_ipv6.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-01-10 05:49:34 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:16 -0500
commit89918fc270bb77cb1a0703f0ea566a692b32e324 (patch)
treec1a2171b2e1801cbdbe1b9a58411290479774313 /net/ipv6/sysctl_net_ipv6.c
parentb0f159db7c95babf1e321334eb33d42db94f2854 (diff)
[NETNS][IPV6]: Make the ipv6 sysctl to be a netns subsystem.
The initialization of the sysctl for the ipv6 protocol is changed to a network namespace subsystem. That means when a new network namespace is created the initialization function for the sysctl will be called. That do not change the behavior of the sysctl in case of the kernel with the network namespace disabled. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/sysctl_net_ipv6.c')
-rw-r--r--net/ipv6/sysctl_net_ipv6.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index f713fbf34c23..7329decf1f9d 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -91,10 +91,10 @@ EXPORT_SYMBOL_GPL(net_ipv6_ctl_path);
91 91
92static struct ctl_table_header *ipv6_sysctl_header; 92static struct ctl_table_header *ipv6_sysctl_header;
93 93
94int ipv6_sysctl_register(void) 94static int ipv6_sysctl_net_init(struct net *net)
95{ 95{
96 ipv6_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, 96 ipv6_sysctl_header = register_net_sysctl_table(net, net_ipv6_ctl_path,
97 ipv6_table); 97 ipv6_table);
98 if (!ipv6_sysctl_header) 98 if (!ipv6_sysctl_header)
99 return -ENOMEM; 99 return -ENOMEM;
100 100
@@ -102,7 +102,22 @@ int ipv6_sysctl_register(void)
102 102
103} 103}
104 104
105static void ipv6_sysctl_net_exit(struct net *net)
106{
107 unregister_net_sysctl_table(ipv6_sysctl_header);
108}
109
110static struct pernet_operations ipv6_sysctl_net_ops = {
111 .init = ipv6_sysctl_net_init,
112 .exit = ipv6_sysctl_net_exit,
113};
114
115int ipv6_sysctl_register(void)
116{
117 return register_pernet_subsys(&ipv6_sysctl_net_ops);
118}
119
105void ipv6_sysctl_unregister(void) 120void ipv6_sysctl_unregister(void)
106{ 121{
107 unregister_sysctl_table(ipv6_sysctl_header); 122 unregister_pernet_subsys(&ipv6_sysctl_net_ops);
108} 123}