aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-02-28 23:51:18 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 23:51:18 -0500
commit73b3871165e45ea6d57775c6bfb1a1760ad6e36b (patch)
tree1e3d8e162e360a3c120dfbf73c62144acc9f994a /net/ipv4/route.c
parenta75e936f2f1ba8428f70b204f3ddd3a7ff17d281 (diff)
[NETNS]: Register /proc/net/rt_cache for each namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c24
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
548static __init int ip_rt_proc_init(struct net *net) 548static 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:
576err1: 576err1:
577 return -ENOMEM; 577 return -ENOMEM;
578} 578}
579
580static 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
587static 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
592static int __init ip_rt_proc_init(void)
593{
594 return register_pernet_subsys(&ip_rt_proc_ops);
595}
596
579#else 597#else
580static inline int ip_rt_proc_init(struct net *net) 598static 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();