diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-04-10 16:13:57 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-04-22 17:50:08 +0300 |
| commit | a988a0a88a09ad5b88eac299bb10b7b8aa64db6a (patch) | |
| tree | dbf396c110b177fcc192f13fed247fd473ef4001 /zebra/zapi_msg.c | |
| parent | e53bd693263792f45554b8b20a9264d6c518ad86 (diff) | |
*: Use uint64_t for weight down the path to Zebra
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 76cabd1bf0..d585ef996b 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1724,7 +1724,7 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p, * Let's convert the weights to a scaled value * between 1 and zrouter.nexthop_weight_scale_value * This is a simple application of a ratio: - * scaled_weight/zrouter.nexthop_weight_scale_value = + * scaled_weight/zrouter.nexthop_weight_scale_value = * weight/max_weight * This translates to: * scaled_weight = weight * zrouter.nexthop_weight_scale_value @@ -1738,9 +1738,8 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p, for (i = 0; i < nexthop_num; i++) { znh = &nhops[i]; - tmp = (uint64_t)znh->weight * - zrouter.nexthop_weight_scale_value; - znh->weight = MAX(1, ((uint32_t)(tmp / max_weight))); + tmp = znh->weight * zrouter.nexthop_weight_scale_value; + znh->weight = MAX(1, (tmp / max_weight)); } } |
