aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-04 16:46:23 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-04 16:46:23 -0500
commit69ddb80562a460d6d9edafe33a5bee06ca18b1a1 (patch)
tree282ef74159660c9337d7a3997c8f803def9dba65
parent606a2b4862d4be31fa55cad89871fe52a422d511 (diff)
[NETNS][IPV6] route6 - Make proc entry /proc/net/rt6_stats per namespace
Make the proc entry /proc/net/rt6_stats work in all network namespace. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d9d840ced1c6..ebd9033fece3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2353,21 +2353,31 @@ static const struct file_operations ipv6_route_proc_fops = {
2353 2353
2354static int rt6_stats_seq_show(struct seq_file *seq, void *v) 2354static int rt6_stats_seq_show(struct seq_file *seq, void *v)
2355{ 2355{
2356 struct net *net = (struct net *)seq->private;
2356 seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n", 2357 seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n",
2357 init_net.ipv6.rt6_stats->fib_nodes, 2358 net->ipv6.rt6_stats->fib_nodes,
2358 init_net.ipv6.rt6_stats->fib_route_nodes, 2359 net->ipv6.rt6_stats->fib_route_nodes,
2359 init_net.ipv6.rt6_stats->fib_rt_alloc, 2360 net->ipv6.rt6_stats->fib_rt_alloc,
2360 init_net.ipv6.rt6_stats->fib_rt_entries, 2361 net->ipv6.rt6_stats->fib_rt_entries,
2361 init_net.ipv6.rt6_stats->fib_rt_cache, 2362 net->ipv6.rt6_stats->fib_rt_cache,
2362 atomic_read(&ip6_dst_ops.entries), 2363 atomic_read(&ip6_dst_ops.entries),
2363 init_net.ipv6.rt6_stats->fib_discarded_routes); 2364 net->ipv6.rt6_stats->fib_discarded_routes);
2364 2365
2365 return 0; 2366 return 0;
2366} 2367}
2367 2368
2368static int rt6_stats_seq_open(struct inode *inode, struct file *file) 2369static int rt6_stats_seq_open(struct inode *inode, struct file *file)
2369{ 2370{
2370 return single_open(file, rt6_stats_seq_show, NULL); 2371 struct net *net = get_proc_net(inode);
2372 return single_open(file, rt6_stats_seq_show, net);
2373}
2374
2375static int rt6_stats_seq_release(struct inode *inode, struct file *file)
2376{
2377 struct seq_file *seq = file->private_data;
2378 struct net *net = (struct net *)seq->private;
2379 put_net(net);
2380 return single_release(inode, file);
2371} 2381}
2372 2382
2373static const struct file_operations rt6_stats_seq_fops = { 2383static const struct file_operations rt6_stats_seq_fops = {
@@ -2375,7 +2385,7 @@ static const struct file_operations rt6_stats_seq_fops = {
2375 .open = rt6_stats_seq_open, 2385 .open = rt6_stats_seq_open,
2376 .read = seq_read, 2386 .read = seq_read,
2377 .llseek = seq_lseek, 2387 .llseek = seq_lseek,
2378 .release = single_release, 2388 .release = rt6_stats_seq_release,
2379}; 2389};
2380#endif /* CONFIG_PROC_FS */ 2390#endif /* CONFIG_PROC_FS */
2381 2391