summaryrefslogtreecommitdiff
path: root/bgpd/bgp_routemap.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-04-08 09:22:02 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-04-22 17:48:37 +0300
commite0b64f241454c60abeb91ee72773d279c8699095 (patch)
tree8be50e1a00566745bffc7913af881c5baa873b3f /bgpd/bgp_routemap.c
parent85292ef926205b36d6550f90e8231184efc941ff (diff)
bgpd: Convert 32-bit to 64-bit link bandwidth variable (link_bw)
This is needed to implement and use larger bandwidths rather than limiting only to theoretical 34Gbps max bandwidth. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_routemap.c')
-rw-r--r--bgpd/bgp_routemap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 15828b6594..8b0872bbed 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -3196,7 +3196,7 @@ struct rmap_ecomm_lb_set {
#define RMAP_ECOMM_LB_SET_CUMUL 2
#define RMAP_ECOMM_LB_SET_NUM_MPATH 3
bool non_trans;
- uint32_t bw;
+ uint64_t bw;
};
static enum route_map_cmd_result_t
@@ -3207,7 +3207,7 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, void *object)
struct peer *peer;
struct ecommunity ecom_lb = {0};
struct ecommunity_val lb_eval;
- uint32_t bw_bytes = 0;
+ uint64_t bw_bytes = 0;
uint16_t mpath_count = 0;
struct ecommunity *new_ecom;
struct ecommunity *old_ecom;
@@ -3221,13 +3221,13 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, void *object)
/* Build link bandwidth extended community */
as = (peer->bgp->as > BGP_AS_MAX) ? BGP_AS_TRANS : peer->bgp->as;
if (rels->lb_type == RMAP_ECOMM_LB_SET_VALUE) {
- bw_bytes = ((uint64_t)rels->bw * 1000 * 1000) / 8;
+ bw_bytes = (rels->bw * 1000 * 1000) / 8;
} else if (rels->lb_type == RMAP_ECOMM_LB_SET_CUMUL) {
/* process this only for the best path. */
if (!CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
return RMAP_OKAY;
- bw_bytes = (uint32_t)bgp_path_info_mpath_cumbw(path);
+ bw_bytes = bgp_path_info_mpath_cumbw(path);
if (!bw_bytes)
return RMAP_OKAY;
@@ -3237,7 +3237,7 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, void *object)
if (!CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
return RMAP_OKAY;
- bw_bytes = ((uint64_t)peer->bgp->lb_ref_bw * 1000 * 1000) / 8;
+ bw_bytes = (peer->bgp->lb_ref_bw * 1000 * 1000) / 8;
mpath_count = bgp_path_info_mpath_count(path) + 1;
bw_bytes *= mpath_count;
}
@@ -3275,7 +3275,7 @@ static void *route_set_ecommunity_lb_compile(const char *arg)
{
struct rmap_ecomm_lb_set *rels;
uint8_t lb_type;
- uint32_t bw = 0;
+ uint64_t bw = 0;
char bw_str[40] = {0};
char *p, *str;
bool non_trans = false;