diff options
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 16ebf85d4ad2..57640620c165 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -247,12 +247,27 @@ static int ipv6_proc_init_net(struct net *net) | |||
247 | if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, | 247 | if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, |
248 | &sockstat6_seq_fops)) | 248 | &sockstat6_seq_fops)) |
249 | return -ENOMEM; | 249 | return -ENOMEM; |
250 | |||
251 | if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops)) | ||
252 | goto proc_snmp6_fail; | ||
253 | |||
254 | net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net); | ||
255 | if (!net->mib.proc_net_devsnmp6) | ||
256 | goto proc_dev_snmp6_fail; | ||
250 | return 0; | 257 | return 0; |
258 | |||
259 | proc_snmp6_fail: | ||
260 | proc_net_remove(net, "sockstat6"); | ||
261 | proc_dev_snmp6_fail: | ||
262 | proc_net_remove(net, "dev_snmp6"); | ||
263 | return -ENOMEM; | ||
251 | } | 264 | } |
252 | 265 | ||
253 | static void ipv6_proc_exit_net(struct net *net) | 266 | static void ipv6_proc_exit_net(struct net *net) |
254 | { | 267 | { |
255 | proc_net_remove(net, "sockstat6"); | 268 | proc_net_remove(net, "sockstat6"); |
269 | proc_net_remove(net, "dev_snmp6"); | ||
270 | proc_net_remove(net, "snmp6"); | ||
256 | } | 271 | } |
257 | 272 | ||
258 | static struct pernet_operations ipv6_proc_ops = { | 273 | static struct pernet_operations ipv6_proc_ops = { |
@@ -262,34 +277,11 @@ static struct pernet_operations ipv6_proc_ops = { | |||
262 | 277 | ||
263 | int __init ipv6_misc_proc_init(void) | 278 | int __init ipv6_misc_proc_init(void) |
264 | { | 279 | { |
265 | int rc = 0; | 280 | return register_pernet_subsys(&ipv6_proc_ops); |
266 | |||
267 | if (register_pernet_subsys(&ipv6_proc_ops)) | ||
268 | goto proc_net_fail; | ||
269 | |||
270 | if (!proc_net_fops_create(&init_net, "snmp6", S_IRUGO, &snmp6_seq_fops)) | ||
271 | goto proc_snmp6_fail; | ||
272 | |||
273 | init_net.mib.proc_net_devsnmp6 = | ||
274 | proc_mkdir("dev_snmp6", init_net.proc_net); | ||
275 | if (!init_net.mib.proc_net_devsnmp6) | ||
276 | goto proc_dev_snmp6_fail; | ||
277 | out: | ||
278 | return rc; | ||
279 | |||
280 | proc_dev_snmp6_fail: | ||
281 | proc_net_remove(&init_net, "snmp6"); | ||
282 | proc_snmp6_fail: | ||
283 | unregister_pernet_subsys(&ipv6_proc_ops); | ||
284 | proc_net_fail: | ||
285 | rc = -ENOMEM; | ||
286 | goto out; | ||
287 | } | 281 | } |
288 | 282 | ||
289 | void ipv6_misc_proc_exit(void) | 283 | void ipv6_misc_proc_exit(void) |
290 | { | 284 | { |
291 | proc_net_remove(&init_net, "dev_snmp6"); | ||
292 | proc_net_remove(&init_net, "snmp6"); | ||
293 | unregister_pernet_subsys(&ipv6_proc_ops); | 285 | unregister_pernet_subsys(&ipv6_proc_ops); |
294 | } | 286 | } |
295 | 287 | ||