aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-02-28 23:50:55 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 23:50:55 -0500
commita75e936f2f1ba8428f70b204f3ddd3a7ff17d281 (patch)
tree96ec0b9caec0bfe9b1cfd8a1300d21ec2f3766f4 /net/ipv4
parent642d6318119af60ac019524bd4edcfbd19d9d211 (diff)
[NETNS]: Process /proc/net/rt_cache inside a namespace.
Show routing cache for a particular namespace only. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/route.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f9654f2ae5b3..af0b23ad93ba 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -273,6 +273,7 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr)
273 273
274#ifdef CONFIG_PROC_FS 274#ifdef CONFIG_PROC_FS
275struct rt_cache_iter_state { 275struct rt_cache_iter_state {
276 struct seq_net_private p;
276 int bucket; 277 int bucket;
277 int genid; 278 int genid;
278}; 279};
@@ -285,7 +286,8 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
285 rcu_read_lock_bh(); 286 rcu_read_lock_bh();
286 r = rcu_dereference(rt_hash_table[st->bucket].chain); 287 r = rcu_dereference(rt_hash_table[st->bucket].chain);
287 while (r) { 288 while (r) {
288 if (r->rt_genid == st->genid) 289 if (r->u.dst.dev->nd_net == st->p.net &&
290 r->rt_genid == st->genid)
289 return r; 291 return r;
290 r = rcu_dereference(r->u.dst.rt_next); 292 r = rcu_dereference(r->u.dst.rt_next);
291 } 293 }
@@ -312,6 +314,8 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st,
312 struct rtable *r) 314 struct rtable *r)
313{ 315{
314 while ((r = __rt_cache_get_next(st, r)) != NULL) { 316 while ((r = __rt_cache_get_next(st, r)) != NULL) {
317 if (r->u.dst.dev->nd_net != st->p.net)
318 continue;
315 if (r->rt_genid == st->genid) 319 if (r->rt_genid == st->genid)
316 break; 320 break;
317 } 321 }
@@ -398,7 +402,7 @@ static const struct seq_operations rt_cache_seq_ops = {
398 402
399static int rt_cache_seq_open(struct inode *inode, struct file *file) 403static int rt_cache_seq_open(struct inode *inode, struct file *file)
400{ 404{
401 return seq_open_private(file, &rt_cache_seq_ops, 405 return seq_open_net(inode, file, &rt_cache_seq_ops,
402 sizeof(struct rt_cache_iter_state)); 406 sizeof(struct rt_cache_iter_state));
403} 407}
404 408
@@ -407,7 +411,7 @@ static const struct file_operations rt_cache_seq_fops = {
407 .open = rt_cache_seq_open, 411 .open = rt_cache_seq_open,
408 .read = seq_read, 412 .read = seq_read,
409 .llseek = seq_lseek, 413 .llseek = seq_lseek,
410 .release = seq_release_private, 414 .release = seq_release_net,
411}; 415};
412 416
413 417