diff options
author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2022-02-23 18:33:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 18:33:46 +0100 |
commit | eaba619fc183f68a456b3918f449185b3b477426 (patch) | |
tree | 462ea355549d71f0b61803b21ae57217d051d128 /eigrpd/eigrp_metric.c | |
parent | Merge pull request #10585 from ton31337/feature/advmap_set (diff) | |
parent | pceplib: Fix uninited data in test vehicle (diff) | |
download | frr-eaba619fc183f68a456b3918f449185b3b477426.tar.xz frr-eaba619fc183f68a456b3918f449185b3b477426.zip |
Merge pull request #10621 from donaldsharp/cov_fun
Cov fun
Diffstat (limited to 'eigrpd/eigrp_metric.c')
-rw-r--r-- | eigrpd/eigrp_metric.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/eigrpd/eigrp_metric.c b/eigrpd/eigrp_metric.c index ea62f9d1b..7ccafd4fa 100644 --- a/eigrpd/eigrp_metric.c +++ b/eigrpd/eigrp_metric.c @@ -86,19 +86,24 @@ eigrp_metric_t eigrp_calculate_metrics(struct eigrp *eigrp, */ if (eigrp->k_values[0]) - composite += (eigrp->k_values[0] * metric.bandwidth); + composite += ((eigrp_metric_t)eigrp->k_values[0] * + (eigrp_metric_t)metric.bandwidth); if (eigrp->k_values[1]) - composite += ((eigrp->k_values[1] * metric.bandwidth) - / (256 - metric.load)); + composite += (((eigrp_metric_t)eigrp->k_values[1] * + (eigrp_metric_t)metric.bandwidth) / + (256 - metric.load)); if (eigrp->k_values[2]) - composite += (eigrp->k_values[2] * metric.delay); + composite += ((eigrp_metric_t)eigrp->k_values[2] * + (eigrp_metric_t)metric.delay); if (eigrp->k_values[3] && !eigrp->k_values[4]) - composite *= eigrp->k_values[3]; + composite *= (eigrp_metric_t)eigrp->k_values[3]; if (!eigrp->k_values[3] && eigrp->k_values[4]) - composite *= (eigrp->k_values[4] / metric.reliability); + composite *= ((eigrp_metric_t)eigrp->k_values[4] / + (eigrp_metric_t)metric.reliability); if (eigrp->k_values[3] && eigrp->k_values[4]) - composite *= ((eigrp->k_values[4] / metric.reliability) - + eigrp->k_values[3]); + composite *= (((eigrp_metric_t)eigrp->k_values[4] / + (eigrp_metric_t)metric.reliability) + + (eigrp_metric_t)eigrp->k_values[3]); composite = (composite <= EIGRP_METRIC_MAX) ? composite : EIGRP_METRIC_MAX; |