pud: ignore zero bandwidth/uni-directional link gateways
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 25 Jul 2012 19:18:24 +0000 (21:18 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 25 Jul 2012 19:24:25 +0000 (21:24 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/uplinkGateway.c

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