diff options
| -rw-r--r-- | net/ipv4/fib_trie.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 271c89bdf049..31494f335686 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -1384,8 +1384,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | |||
| 1384 | t_key cindex = 0; | 1384 | t_key cindex = 0; |
| 1385 | int current_prefix_length = KEYLENGTH; | 1385 | int current_prefix_length = KEYLENGTH; |
| 1386 | struct tnode *cn; | 1386 | struct tnode *cn; |
| 1387 | t_key node_prefix, key_prefix, pref_mismatch; | 1387 | t_key pref_mismatch; |
| 1388 | int mp; | ||
| 1389 | 1388 | ||
| 1390 | rcu_read_lock(); | 1389 | rcu_read_lock(); |
| 1391 | 1390 | ||
| @@ -1500,10 +1499,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | |||
| 1500 | * matching prefix. | 1499 | * matching prefix. |
| 1501 | */ | 1500 | */ |
| 1502 | 1501 | ||
| 1503 | node_prefix = mask_pfx(cn->key, cn->pos); | 1502 | pref_mismatch = mask_pfx(cn->key ^ key, cn->pos); |
| 1504 | key_prefix = mask_pfx(key, cn->pos); | ||
| 1505 | pref_mismatch = key_prefix^node_prefix; | ||
| 1506 | mp = 0; | ||
| 1507 | 1503 | ||
| 1508 | /* | 1504 | /* |
| 1509 | * In short: If skipped bits in this node do not match | 1505 | * In short: If skipped bits in this node do not match |
| @@ -1511,13 +1507,9 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | |||
| 1511 | * state.directly. | 1507 | * state.directly. |
| 1512 | */ | 1508 | */ |
| 1513 | if (pref_mismatch) { | 1509 | if (pref_mismatch) { |
| 1514 | while (!(pref_mismatch & (1<<(KEYLENGTH-1)))) { | 1510 | int mp = KEYLENGTH - fls(pref_mismatch); |
| 1515 | mp++; | ||
| 1516 | pref_mismatch = pref_mismatch << 1; | ||
| 1517 | } | ||
| 1518 | key_prefix = tkey_extract_bits(cn->key, mp, cn->pos-mp); | ||
| 1519 | 1511 | ||
| 1520 | if (key_prefix != 0) | 1512 | if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) |
| 1521 | goto backtrace; | 1513 | goto backtrace; |
| 1522 | 1514 | ||
| 1523 | if (current_prefix_length >= cn->pos) | 1515 | if (current_prefix_length >= cn->pos) |
