|
@@ -1802,80 +1802,6 @@ void fib_free_table(struct fib_table *tb)
|
|
|
kfree(tb);
|
|
|
}
|
|
|
|
|
|
-void fib_table_select_default(struct fib_table *tb,
|
|
|
- const struct flowi *flp,
|
|
|
- struct fib_result *res)
|
|
|
-{
|
|
|
- struct trie *t = (struct trie *) tb->tb_data;
|
|
|
- int order, last_idx;
|
|
|
- struct fib_info *fi = NULL;
|
|
|
- struct fib_info *last_resort;
|
|
|
- struct fib_alias *fa = NULL;
|
|
|
- struct list_head *fa_head;
|
|
|
- struct leaf *l;
|
|
|
-
|
|
|
- last_idx = -1;
|
|
|
- last_resort = NULL;
|
|
|
- order = -1;
|
|
|
-
|
|
|
- rcu_read_lock();
|
|
|
-
|
|
|
- l = fib_find_node(t, 0);
|
|
|
- if (!l)
|
|
|
- goto out;
|
|
|
-
|
|
|
- fa_head = get_fa_head(l, 0);
|
|
|
- if (!fa_head)
|
|
|
- goto out;
|
|
|
-
|
|
|
- if (list_empty(fa_head))
|
|
|
- goto out;
|
|
|
-
|
|
|
- list_for_each_entry_rcu(fa, fa_head, fa_list) {
|
|
|
- struct fib_info *next_fi = fa->fa_info;
|
|
|
-
|
|
|
- if (fa->fa_scope != res->scope ||
|
|
|
- fa->fa_type != RTN_UNICAST)
|
|
|
- continue;
|
|
|
-
|
|
|
- if (next_fi->fib_priority > res->fi->fib_priority)
|
|
|
- break;
|
|
|
- if (!next_fi->fib_nh[0].nh_gw ||
|
|
|
- next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK)
|
|
|
- continue;
|
|
|
-
|
|
|
- fib_alias_accessed(fa);
|
|
|
-
|
|
|
- if (fi == NULL) {
|
|
|
- if (next_fi != res->fi)
|
|
|
- break;
|
|
|
- } else if (!fib_detect_death(fi, order, &last_resort,
|
|
|
- &last_idx, tb->tb_default)) {
|
|
|
- fib_result_assign(res, fi);
|
|
|
- tb->tb_default = order;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- fi = next_fi;
|
|
|
- order++;
|
|
|
- }
|
|
|
- if (order <= 0 || fi == NULL) {
|
|
|
- tb->tb_default = -1;
|
|
|
- goto out;
|
|
|
- }
|
|
|
-
|
|
|
- if (!fib_detect_death(fi, order, &last_resort, &last_idx,
|
|
|
- tb->tb_default)) {
|
|
|
- fib_result_assign(res, fi);
|
|
|
- tb->tb_default = order;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- if (last_idx >= 0)
|
|
|
- fib_result_assign(res, last_resort);
|
|
|
- tb->tb_default = last_idx;
|
|
|
-out:
|
|
|
- rcu_read_unlock();
|
|
|
-}
|
|
|
-
|
|
|
static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah,
|
|
|
struct fib_table *tb,
|
|
|
struct sk_buff *skb, struct netlink_callback *cb)
|