diff options
-rw-r--r-- | net/ipv4/route.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index af0b23ad93ba..b1a311eb18e5 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -545,7 +545,7 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset, | |||
545 | } | 545 | } |
546 | #endif | 546 | #endif |
547 | 547 | ||
548 | static __init int ip_rt_proc_init(struct net *net) | 548 | static int __net_init ip_rt_do_proc_init(struct net *net) |
549 | { | 549 | { |
550 | struct proc_dir_entry *pde; | 550 | struct proc_dir_entry *pde; |
551 | 551 | ||
@@ -576,8 +576,26 @@ err2: | |||
576 | err1: | 576 | err1: |
577 | return -ENOMEM; | 577 | return -ENOMEM; |
578 | } | 578 | } |
579 | |||
580 | static void __net_exit ip_rt_do_proc_exit(struct net *net) | ||
581 | { | ||
582 | remove_proc_entry("rt_cache", net->proc_net_stat); | ||
583 | remove_proc_entry("rt_cache", net->proc_net); | ||
584 | remove_proc_entry("rt_acct", net->proc_net); | ||
585 | } | ||
586 | |||
587 | static struct pernet_operations ip_rt_proc_ops __net_initdata = { | ||
588 | .init = ip_rt_do_proc_init, | ||
589 | .exit = ip_rt_do_proc_exit, | ||
590 | }; | ||
591 | |||
592 | static int __init ip_rt_proc_init(void) | ||
593 | { | ||
594 | return register_pernet_subsys(&ip_rt_proc_ops); | ||
595 | } | ||
596 | |||
579 | #else | 597 | #else |
580 | static inline int ip_rt_proc_init(struct net *net) | 598 | static inline int ip_rt_proc_init(void) |
581 | { | 599 | { |
582 | return 0; | 600 | return 0; |
583 | } | 601 | } |
@@ -3055,7 +3073,7 @@ int __init ip_rt_init(void) | |||
3055 | ip_rt_secret_interval; | 3073 | ip_rt_secret_interval; |
3056 | add_timer(&rt_secret_timer); | 3074 | add_timer(&rt_secret_timer); |
3057 | 3075 | ||
3058 | if (ip_rt_proc_init(&init_net)) | 3076 | if (ip_rt_proc_init()) |
3059 | printk(KERN_ERR "Unable to create route proc files\n"); | 3077 | printk(KERN_ERR "Unable to create route proc files\n"); |
3060 | #ifdef CONFIG_XFRM | 3078 | #ifdef CONFIG_XFRM |
3061 | xfrm_init(); | 3079 | xfrm_init(); |