PUD: do not consider nodes with an infinite ETX as cluster leaders
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 14 Feb 2012 13:29:50 +0000 (14:29 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 14 Feb 2012 13:30:09 +0000 (14:30 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/uplinkGateway.c

index deba8aa..4d1b0f9 100644 (file)
@@ -7,6 +7,7 @@
 #include "tc_set.h"
 #include "ipcalc.h"
 #include "olsr_types.h"
+#include "lq_plugin.h"
 
 /* System includes */
 #include <stddef.h>
@@ -54,6 +55,11 @@ union olsr_ip_addr * getBestUplinkGateway(void) {
                        continue;
                }
 
+               /* do not consider nodes with an infinite ETX */
+               if (tc->path_cost == ROUTE_COST_BROKEN) {
+                       continue;
+               }
+
                if (gw == olsr_get_ipv4_inet_gateway(NULL)) {
                        eval4 = true;
                } else if (gw->ipv4