diff options
author | Denis V. Lunev <den@openvz.org> | 2007-12-08 03:32:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:01 -0500 |
commit | 971b893e79db0f7dccfcea15dbdebca3ca64a84d (patch) | |
tree | e04d0a7c05aec59f1eb2253e7e73d0bdc2f8aed8 /net/ipv4/fib_hash.c | |
parent | a2bbe6822f8928e254452765c07cb863633113b8 (diff) |
[IPV4]: last default route is a fib table property
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/fib_hash.c')
-rw-r--r-- | net/ipv4/fib_hash.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 86087d45c64e..9d5404158476 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -272,8 +272,6 @@ out: | |||
272 | return err; | 272 | return err; |
273 | } | 273 | } |
274 | 274 | ||
275 | static int fn_hash_last_dflt=-1; | ||
276 | |||
277 | static void | 275 | static void |
278 | fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) | 276 | fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) |
279 | { | 277 | { |
@@ -314,9 +312,9 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
314 | if (next_fi != res->fi) | 312 | if (next_fi != res->fi) |
315 | break; | 313 | break; |
316 | } else if (!fib_detect_death(fi, order, &last_resort, | 314 | } else if (!fib_detect_death(fi, order, &last_resort, |
317 | &last_idx, fn_hash_last_dflt)) { | 315 | &last_idx, tb->tb_default)) { |
318 | fib_result_assign(res, fi); | 316 | fib_result_assign(res, fi); |
319 | fn_hash_last_dflt = order; | 317 | tb->tb_default = order; |
320 | goto out; | 318 | goto out; |
321 | } | 319 | } |
322 | fi = next_fi; | 320 | fi = next_fi; |
@@ -325,19 +323,20 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
325 | } | 323 | } |
326 | 324 | ||
327 | if (order <= 0 || fi == NULL) { | 325 | if (order <= 0 || fi == NULL) { |
328 | fn_hash_last_dflt = -1; | 326 | tb->tb_default = -1; |
329 | goto out; | 327 | goto out; |
330 | } | 328 | } |
331 | 329 | ||
332 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, fn_hash_last_dflt)) { | 330 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, |
331 | tb->tb_default)) { | ||
333 | fib_result_assign(res, fi); | 332 | fib_result_assign(res, fi); |
334 | fn_hash_last_dflt = order; | 333 | tb->tb_default = order; |
335 | goto out; | 334 | goto out; |
336 | } | 335 | } |
337 | 336 | ||
338 | if (last_idx >= 0) | 337 | if (last_idx >= 0) |
339 | fib_result_assign(res, last_resort); | 338 | fib_result_assign(res, last_resort); |
340 | fn_hash_last_dflt = last_idx; | 339 | tb->tb_default = last_idx; |
341 | out: | 340 | out: |
342 | read_unlock(&fib_hash_lock); | 341 | read_unlock(&fib_hash_lock); |
343 | } | 342 | } |
@@ -773,6 +772,7 @@ struct fib_table * __init fib_hash_init(u32 id) | |||
773 | return NULL; | 772 | return NULL; |
774 | 773 | ||
775 | tb->tb_id = id; | 774 | tb->tb_id = id; |
775 | tb->tb_default = -1; | ||
776 | tb->tb_lookup = fn_hash_lookup; | 776 | tb->tb_lookup = fn_hash_lookup; |
777 | tb->tb_insert = fn_hash_insert; | 777 | tb->tb_insert = fn_hash_insert; |
778 | tb->tb_delete = fn_hash_delete; | 778 | tb->tb_delete = fn_hash_delete; |