diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-28 23:50:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-28 23:50:33 -0500 |
commit | 642d6318119af60ac019524bd4edcfbd19d9d211 (patch) | |
tree | 7de60bd02fd71902133ce6920afeed496d897782 /net/ipv4/route.c | |
parent | 317805b8f875ca1bd43d594c0a210e24fab7d177 (diff) |
[IPV4]: rt_cache_get_next should take rt_genid into account.
In the other case /proc/net/rt_cache will look inconsistent in respect to
genid.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ad6eadd12b4a..f9654f2ae5b3 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -294,7 +294,8 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | |||
294 | return r; | 294 | return r; |
295 | } | 295 | } |
296 | 296 | ||
297 | static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, struct rtable *r) | 297 | static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st, |
298 | struct rtable *r) | ||
298 | { | 299 | { |
299 | r = r->u.dst.rt_next; | 300 | r = r->u.dst.rt_next; |
300 | while (!r) { | 301 | while (!r) { |
@@ -307,16 +308,23 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, struct r | |||
307 | return rcu_dereference(r); | 308 | return rcu_dereference(r); |
308 | } | 309 | } |
309 | 310 | ||
311 | static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | ||
312 | struct rtable *r) | ||
313 | { | ||
314 | while ((r = __rt_cache_get_next(st, r)) != NULL) { | ||
315 | if (r->rt_genid == st->genid) | ||
316 | break; | ||
317 | } | ||
318 | return r; | ||
319 | } | ||
320 | |||
310 | static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos) | 321 | static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos) |
311 | { | 322 | { |
312 | struct rtable *r = rt_cache_get_first(st); | 323 | struct rtable *r = rt_cache_get_first(st); |
313 | 324 | ||
314 | if (r) | 325 | if (r) |
315 | while (pos && (r = rt_cache_get_next(st, r))) { | 326 | while (pos && (r = rt_cache_get_next(st, r))) |
316 | if (r->rt_genid != st->genid) | ||
317 | continue; | ||
318 | --pos; | 327 | --pos; |
319 | } | ||
320 | return pos ? NULL : r; | 328 | return pos ? NULL : r; |
321 | } | 329 | } |
322 | 330 | ||