]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix bandwidth multiplier for link param 6428/head
authorEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 19 May 2020 13:53:02 +0000 (15:53 +0200)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 19 May 2020 15:08:04 +0000 (17:08 +0200)
in the CLI we state that the bandwidth of a link is
in Megabits per second, but when converting it to
Bytes per second for TE purposes we were treating
it as Kilobits. Fix the conversion error.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
lib/if.c
lib/if.h

index 5c0f5e61aacc0a7d26f381ad492323c407a1aa5d..a1e02f4f309dd4199c18bb5ee52fc9ee3fd6038f 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -1274,7 +1274,7 @@ struct if_link_params *if_link_params_get(struct interface *ifp)
        /* Compute default bandwidth based on interface */
        iflp->default_bw =
                ((ifp->bandwidth ? ifp->bandwidth : DEFAULT_BANDWIDTH)
-                * TE_KILO_BIT / TE_BYTE);
+                * TE_MEGA_BIT / TE_BYTE);
 
        /* Set Max, Reservable and Unreserved Bandwidth */
        iflp->max_bw = iflp->default_bw;
index 6a36806566d03ea344275dc03f0cd2f9680347ce..8dc418f20b46f760fc0976a51656c67a840bdcdc 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -143,7 +143,7 @@ struct if_stats {
 #define TE_EXT_MASK             0x0FFFFFFF
 #define TE_EXT_ANORMAL          0x80000000
 #define LOSS_PRECISION          0.000003
-#define TE_KILO_BIT             1000
+#define TE_MEGA_BIT             1000000
 #define TE_BYTE                 8
 #define DEFAULT_BANDWIDTH       10000
 #define MAX_CLASS_TYPE          8