blob: ebf843d7b713a786231e2071fd65fb62721a1bb6 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 46093914a5f95f50c9aef088b7172d6774d204cb Mon Sep 17 00:00:00 2001
2From: Oryon <pierre@darou.fr>
3Date: Tue, 11 Mar 2014 16:03:58 +0100
4Subject: [PATCH 2/2] Metric should be more important than distance at lookup
5
6---
7 src/mrib.cpp | 10 +++++-----
8 1 file changed, 5 insertions(+), 5 deletions(-)
9
10--- a/src/mrib.cpp
11+++ b/src/mrib.cpp
12@@ -327,16 +327,16 @@ mrib_def::mrib_node *mrib_def::prefix_lo
13 void mrib_def::insert_prefix_in_node(mrib_node *n, prefix *p) {
14 prefix *curr = n->head, *prev = 0;
15
16- /* first check the proper place based on distance */
17- while (curr && curr->distance < p->distance) {
18+ /* first check the proper place based on metric */
19+ while (curr && curr->metric < p->metric) {
20 prev = curr;
21 curr = curr->next;
22 }
23
24- if (prev && prev->distance == p->distance) {
25- /* if distance matches, take metric into place */
26+ if (prev && prev->metric == p->metric) {
27+ /* if metric matches, take distance into place */
28 curr = prev;
29- while (curr && curr->metric <= p->metric) {
30+ while (curr && curr->distance <= p->distance) {
31 prev = curr;
32 curr = curr->next;
33 }