Merge pull request #26 from Noltari/mcproxy-next
[feed/routing.git] / mrd6 / patches / 102-Metric-should-be-more-important-than-distance.patch
1 From 46093914a5f95f50c9aef088b7172d6774d204cb Mon Sep 17 00:00:00 2001
2 From: Oryon <pierre@darou.fr>
3 Date: Tue, 11 Mar 2014 16:03:58 +0100
4 Subject: [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 diff --git a/src/mrib.cpp b/src/mrib.cpp
11 index e51fed7..707d601 100644
12 --- a/src/mrib.cpp
13 +++ b/src/mrib.cpp
14 @@ -327,16 +327,16 @@ mrib_def::mrib_node *mrib_def::prefix_lookup_y(const inet6_addr &source) const {
15 void mrib_def::insert_prefix_in_node(mrib_node *n, prefix *p) {
16 prefix *curr = n->head, *prev = 0;
17
18 - /* first check the proper place based on distance */
19 - while (curr && curr->distance < p->distance) {
20 + /* first check the proper place based on metric */
21 + while (curr && curr->metric < p->metric) {
22 prev = curr;
23 curr = curr->next;
24 }
25
26 - if (prev && prev->distance == p->distance) {
27 - /* if distance matches, take metric into place */
28 + if (prev && prev->metric == p->metric) {
29 + /* if metric matches, take distance into place */
30 curr = prev;
31 - while (curr && curr->metric <= p->metric) {
32 + while (curr && curr->distance <= p->distance) {
33 prev = curr;
34 curr = curr->next;
35 }
36 --
37 1.9.0
38