Added checks for NULL returned from get_best_link_to_neighbor in the LQ code
authorAndreas Tonnesen <andreto@olsr.org>
Tue, 29 Nov 2005 18:38:40 +0000 (18:38 +0000)
committerAndreas Tonnesen <andreto@olsr.org>
Tue, 29 Nov 2005 18:38:40 +0000 (18:38 +0000)
src/lq_mpr.c
src/lq_route.c
src/neighbor_table.c
src/process_package.c

index db3f567..d5c83f7 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: lq_mpr.c,v 1.9 2005/02/16 14:44:43 tlopatic Exp $
+ * $Id: lq_mpr.c,v 1.10 2005/11/29 18:37:58 kattemat Exp $
  */
 
 #include "defs.h"
@@ -107,6 +107,9 @@ void olsr_calculate_lq_mpr(void)
 
               link = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
 
+             if(!link)
+               continue;
+
               best = link->loss_link_quality * link->neigh_link_quality;
 
               // see wether we find a better route via an MPR
index e6c2a6c..077746b 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: lq_route.c,v 1.39 2005/11/16 23:55:54 tlopatic Exp $
+ * $Id: lq_route.c,v 1.40 2005/11/29 18:37:58 kattemat Exp $
  */
 
 #include "defs.h"
@@ -426,6 +426,9 @@ void olsr_calculate_lq_routing_table(void)
       {
         link = get_best_link_to_neighbor(&neigh->neighbor_main_addr);
 
+       if(!link)
+         continue;
+
         if (link->loss_link_quality2 >= MIN_LINK_QUALITY &&
             link->neigh_link_quality2 >= MIN_LINK_QUALITY)
           {
index b60b5ba..963ca5a 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: neighbor_table.c,v 1.28 2005/05/29 12:47:45 br1 Exp $
+ * $Id: neighbor_table.c,v 1.29 2005/11/29 18:37:58 kattemat Exp $
  */
 
 
@@ -500,8 +500,13 @@ olsr_print_neighbor_table()
        {
          struct link_entry *link =
             get_best_link_to_neighbor(&neigh->neighbor_main_addr);
-         double best_lq = link->neigh_link_quality;
-         double inv_best_lq = link->loss_link_quality;
+         double best_lq, inv_best_lq;
+
+         if(!link) 
+           continue;
+
+         best_lq = link->neigh_link_quality;
+         inv_best_lq = link->loss_link_quality;
 
           OLSR_PRINTF(1, fstr, olsr_ip_to_string(&neigh->neighbor_main_addr),
                       inv_best_lq, best_lq,
index 207b2b8..c2809de 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: process_package.c,v 1.35 2005/11/17 04:25:44 tlopatic Exp $
+ * $Id: process_package.c,v 1.36 2005/11/29 18:38:40 kattemat Exp $
  */
 
 
@@ -594,6 +594,9 @@ olsr_process_message_neighbors(struct neighbor_entry *neighbor,
 
               link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
 
+             if(!link)
+               continue;
+
               // loop through the one-hop neighbors that see this
               // two hop neighbour