sgw: fix cost calculation for advertised speeds greater or equal than MAX
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 26 Nov 2014 17:04:09 +0000 (18:04 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 26 Nov 2014 17:05:21 +0000 (18:05 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway_costs.c

index 7a4ebf9..b1d8132 100644 (file)
@@ -6,6 +6,7 @@ extern "C" {
 
 #define SCALING_SHIFT_CLASSIC 31
 #define SCALING_SHIFT 23
 
 #define SCALING_SHIFT_CLASSIC 31
 #define SCALING_SHIFT 23
+#define MAX_SMARTGW_SPEED 320000000
 
 int64_t gw_costs_weigh(bool up, const struct costs_weights weights, uint32_t path_cost, uint32_t exitUk, uint32_t exitDk) {
   int64_t costU;
 
 int64_t gw_costs_weigh(bool up, const struct costs_weights weights, uint32_t path_cost, uint32_t exitUk, uint32_t exitDk) {
   int64_t costU;
@@ -27,7 +28,7 @@ int64_t gw_costs_weigh(bool up, const struct costs_weights weights, uint32_t pat
     return INT64_MAX;
   }
 
     return INT64_MAX;
   }
 
-  if ((exitUk == UINT32_MAX) && (exitDk == UINT32_MAX)) {
+  if ((exitUk >= MAX_SMARTGW_SPEED) && (exitDk >= MAX_SMARTGW_SPEED)) {
     /* maximum bandwidth: only consider path costs */
     return path_cost;
   }
     /* maximum bandwidth: only consider path costs */
     return path_cost;
   }