| To: | ja@xxxxxx (Julian Anastasov) |
|---|---|
| Subject: | Re: [IPv4]: More fib_alias insertion fixes |
| From: | Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> |
| Date: | Sun, 26 Sep 2004 18:14:49 +1000 |
| Cc: | davem@xxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <Pine.LNX.4.58.0409260857510.1151@u.domain.uli> |
| Organization: | Core |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | tin/1.7.4-20040225 ("Benbecula") (UNIX) (Linux/2.4.27-hx-1-686-smp (i686)) |
Julian Anastasov <ja@xxxxxx> wrote:
>
> But it still needs one exception: the entries with TOS 0
> must be at tail to allow fn_hash_lookup to match by TOS. With
> random TOS insertion this is not guaranteed, the entries with
> TOS=0 (wildcard) will match before the others.
Good point.
> prev_fa = NULL;
> list_for_each_entry(fa, head, fa_list) {
> if (fa->fa_tos != tos)
> - continue;
> + {
> + if (!prev_fa && fa->fa_tos)
> + continue;
> + /* Stop at TOS 0 or after entries from our
> TOS */
> + return fa;
> + }
Well if we're doing this then we might as well keep it sorted by TOS.
It makes the code simpler, right?
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
===== net/ipv4/fib_hash.c 1.26 vs edited =====
--- 1.26/net/ipv4/fib_hash.c 2004-09-24 06:19:43 +10:00
+++ edited/net/ipv4/fib_hash.c 2004-09-26 18:12:57 +10:00
@@ -442,9 +442,11 @@
prev_fa = NULL;
list_for_each_entry(fa, head, fa_list) {
- if (fa->fa_tos != tos)
- continue;
+ if (fa->fa_tos < tos)
+ break;
prev_fa = fa;
+ if (fa->fa_tos > tos)
+ continue;
if (prio <= fa->fa_info->fib_priority)
break;
}
@@ -506,6 +508,7 @@
*/
if (fa &&
+ fa->fa_tos == tos &&
fa->fa_info->fib_priority == fi->fib_priority) {
struct fib_alias *fa_orig;
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [IPv4]: More fib_alias insertion fixes, Julian Anastasov |
|---|---|
| Next by Date: | Re: [6/6]: jenkins hash for neigh, YOSHIFUJI Hideaki / 吉藤英明 |
| Previous by Thread: | Re: [IPv4]: More fib_alias insertion fixes, Julian Anastasov |
| Next by Thread: | Re: [IPv4]: More fib_alias insertion fixes, Julian Anastasov |
| Indexes: | [Date] [Thread] [Top] [All Lists] |