pud: safer checking against LINK_COST_BROKEN and ROUTE_COST_BROKEN
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 9 Apr 2016 21:37:43 +0000 (23:37 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 11 Apr 2016 10:38:29 +0000 (12:38 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/uplinkGateway.c

index ecb2333..be48469 100644 (file)
@@ -41,7 +41,7 @@ void getBestUplinkGateway(union olsr_ip_addr * bestGateway) {
                bool eval6 = false;
 
                struct tc_entry * tc = olsr_lookup_tc_entry(&gw->originator);
-               if (!tc || (tc->path_cost == ROUTE_COST_BROKEN) || (!gw->uplink || !gw->downlink)) {
+               if (!tc || (tc->path_cost >= ROUTE_COST_BROKEN) || (!gw->uplink || !gw->downlink)) {
                        /* gateways should not exist without tc entry */
                        /* do not consider nodes with an infinite ETX */
                        /* do not consider nodes without bandwidth or with a uni-directional link */