Handle broken links better
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Fri, 29 Apr 2011 07:33:11 +0000 (09:33 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Fri, 29 Apr 2011 07:33:11 +0000 (09:33 +0200)
src/lq_mpr.c
src/olsr_spf.c

index 30eeceb..0620546 100644 (file)
@@ -147,7 +147,9 @@ olsr_calculate_lq_mpr(void)
         best = LINK_COST_BROKEN;
 
         OLSR_FOR_ALL_NBR2_CON_ENTRIES(nbr2, walker, walker_iterator) {
-          if (walker->nbr->is_sym && !walker->nbr->skip && walker->path_linkcost < best) {
+          if (walker->nbr->is_sym && !walker->nbr->skip
+              && walker->second_hop_linkcost < LINK_COST_BROKEN
+              && walker->path_linkcost < best) {
             neigh = walker->nbr;
             best = walker->path_linkcost;
           }
index e7b28c8..6187106 100644 (file)
@@ -183,11 +183,19 @@ olsr_spf_relax(struct avl_tree *cand_tree, struct tc_entry *tc)
 
     assert (tc_edge->edge_inv);
 
-    /*
-     * total quality of the path through this vertex
-     * to the destination of this edge
-     */
-    new_cost = tc->path_cost + tc_edge->edge_inv->common_cost;
+    if (tc_edge->virtual) {
+      new_cost = tc_edge->edge_inv->cost;
+    }
+    else {
+      new_cost = tc_edge->cost;
+    }
+
+    /* check for broken link */
+    if (new_cost >= LINK_COST_BROKEN) {
+      continue;
+    }
+
+    new_cost += tc->path_cost;
 
     OLSR_DEBUG(LOG_ROUTING, "SPF:   exploring edge %s, cost %s\n",
                olsr_ip_to_string(&buf, &tc_edge->T_dest_addr),