Commit 0ed667a9 authored by Julian Anastasov's avatar Julian Anastasov Committed by David S. Miller

[IPV4]: Fix fib_alias TOS walking and insertion.

Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>'
parent 34927f41
...@@ -438,17 +438,15 @@ static struct fib_alias *fib_find_alias(struct fib_node *fn, u8 tos, u32 prio) ...@@ -438,17 +438,15 @@ static struct fib_alias *fib_find_alias(struct fib_node *fn, u8 tos, u32 prio)
{ {
if (fn) { if (fn) {
struct list_head *head = &fn->fn_alias; struct list_head *head = &fn->fn_alias;
struct fib_alias *fa, *prev_fa; struct fib_alias *fa;
prev_fa = NULL;
list_for_each_entry(fa, head, fa_list) { list_for_each_entry(fa, head, fa_list) {
if (fa->fa_tos != tos) if (fa->fa_tos > tos)
continue; continue;
prev_fa = fa; if (fa->fa_info->fib_priority >= prio ||
if (prio <= fa->fa_info->fib_priority) fa->fa_tos < tos)
break; return fa;
} }
return prev_fa;
} }
return NULL; return NULL;
} }
...@@ -505,7 +503,7 @@ fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, ...@@ -505,7 +503,7 @@ fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta,
* and we need to allocate a new one of those as well. * and we need to allocate a new one of those as well.
*/ */
if (fa && if (fa && fa->fa_tos == tos &&
fa->fa_info->fib_priority == fi->fib_priority) { fa->fa_info->fib_priority == fi->fib_priority) {
struct fib_alias *fa_orig; struct fib_alias *fa_orig;
...@@ -586,7 +584,7 @@ fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, ...@@ -586,7 +584,7 @@ fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta,
write_lock_bh(&fib_hash_lock); write_lock_bh(&fib_hash_lock);
if (new_f) if (new_f)
fib_insert_node(fz, new_f); fib_insert_node(fz, new_f);
list_add(&new_fa->fa_list, list_add_tail(&new_fa->fa_list,
(fa ? &fa->fa_list : &f->fn_alias)); (fa ? &fa->fa_list : &f->fn_alias));
write_unlock_bh(&fib_hash_lock); write_unlock_bh(&fib_hash_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment