openwrt-routing/mrd6/patches/102-Metric-should-be-more-i...

34 lines
1.1 KiB
Diff

From 46093914a5f95f50c9aef088b7172d6774d204cb Mon Sep 17 00:00:00 2001
From: Oryon <pierre@darou.fr>
Date: Tue, 11 Mar 2014 16:03:58 +0100
Subject: [PATCH 2/2] Metric should be more important than distance at lookup
---
src/mrib.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/src/mrib.cpp
+++ b/src/mrib.cpp
@@ -327,16 +327,16 @@ mrib_def::mrib_node *mrib_def::prefix_lo
void mrib_def::insert_prefix_in_node(mrib_node *n, prefix *p) {
prefix *curr = n->head, *prev = 0;
- /* first check the proper place based on distance */
- while (curr && curr->distance < p->distance) {
+ /* first check the proper place based on metric */
+ while (curr && curr->metric < p->metric) {
prev = curr;
curr = curr->next;
}
- if (prev && prev->distance == p->distance) {
- /* if distance matches, take metric into place */
+ if (prev && prev->metric == p->metric) {
+ /* if metric matches, take distance into place */
curr = prev;
- while (curr && curr->metric <= p->metric) {
+ while (curr && curr->distance <= p->distance) {
prev = curr;
curr = curr->next;
}