sgw: when there is no best overall link advertise 0 bandwidth
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 21 Nov 2014 11:22:35 +0000 (12:22 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 21 Nov 2014 11:23:00 +0000 (12:23 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index 3cf72c4..974b8f6 100644 (file)
@@ -1551,8 +1551,11 @@ static bool determineBestOverallLink(enum sgw_multi_change_phase phase) {
 
   changed = memcmp(&bestOverallLink, &bestOverallLinkPrevious, sizeof(bestOverallLink));
 
-  if (changed) {
-    if (!bestOverallLink.isOlsr) {
+  if (changed || MSGW_ROUTE_FORCED(phase)) {
+    if (!bestOverallLink.valid) {
+      olsr_cnf->smart_gw_uplink = 0;
+      olsr_cnf->smart_gw_downlink = 0;
+    } else if (!bestOverallLink.isOlsr) {
       olsr_cnf->smart_gw_uplink = bestOverallLink.link.egress->bwCurrent.egressUk;
       olsr_cnf->smart_gw_downlink = bestOverallLink.link.egress->bwCurrent.egressDk;
     } else {