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_trie.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_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index c7c5c6c802df..9126eea71670 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1782,8 +1782,6 @@ static int fn_trie_flush(struct fib_table *tb) | |||
1782 | return found; | 1782 | return found; |
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | static int trie_last_dflt = -1; | ||
1786 | |||
1787 | static void | 1785 | static void |
1788 | fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) | 1786 | fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) |
1789 | { | 1787 | { |
@@ -1830,28 +1828,29 @@ fn_trie_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
1830 | if (next_fi != res->fi) | 1828 | if (next_fi != res->fi) |
1831 | break; | 1829 | break; |
1832 | } else if (!fib_detect_death(fi, order, &last_resort, | 1830 | } else if (!fib_detect_death(fi, order, &last_resort, |
1833 | &last_idx, trie_last_dflt)) { | 1831 | &last_idx, tb->tb_default)) { |
1834 | fib_result_assign(res, fi); | 1832 | fib_result_assign(res, fi); |
1835 | trie_last_dflt = order; | 1833 | tb->tb_default = order; |
1836 | goto out; | 1834 | goto out; |
1837 | } | 1835 | } |
1838 | fi = next_fi; | 1836 | fi = next_fi; |
1839 | order++; | 1837 | order++; |
1840 | } | 1838 | } |
1841 | if (order <= 0 || fi == NULL) { | 1839 | if (order <= 0 || fi == NULL) { |
1842 | trie_last_dflt = -1; | 1840 | tb->tb_default = -1; |
1843 | goto out; | 1841 | goto out; |
1844 | } | 1842 | } |
1845 | 1843 | ||
1846 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, trie_last_dflt)) { | 1844 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, |
1845 | tb->tb_default)) { | ||
1847 | fib_result_assign(res, fi); | 1846 | fib_result_assign(res, fi); |
1848 | trie_last_dflt = order; | 1847 | tb->tb_default = order; |
1849 | goto out; | 1848 | goto out; |
1850 | } | 1849 | } |
1851 | if (last_idx >= 0) | 1850 | if (last_idx >= 0) |
1852 | fib_result_assign(res, last_resort); | 1851 | fib_result_assign(res, last_resort); |
1853 | trie_last_dflt = last_idx; | 1852 | tb->tb_default = last_idx; |
1854 | out:; | 1853 | out: |
1855 | rcu_read_unlock(); | 1854 | rcu_read_unlock(); |
1856 | } | 1855 | } |
1857 | 1856 | ||
@@ -1978,6 +1977,7 @@ struct fib_table * __init fib_hash_init(u32 id) | |||
1978 | return NULL; | 1977 | return NULL; |
1979 | 1978 | ||
1980 | tb->tb_id = id; | 1979 | tb->tb_id = id; |
1980 | tb->tb_default = -1; | ||
1981 | tb->tb_lookup = fn_trie_lookup; | 1981 | tb->tb_lookup = fn_trie_lookup; |
1982 | tb->tb_insert = fn_trie_insert; | 1982 | tb->tb_insert = fn_trie_insert; |
1983 | tb->tb_delete = fn_trie_delete; | 1983 | tb->tb_delete = fn_trie_delete; |