]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: OSPFv3 interface bandwidth handling 1197/head
authorChirag Shah <chirag@cumulusnetworks.com>
Mon, 18 Sep 2017 05:00:37 +0000 (22:00 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Mon, 18 Sep 2017 22:59:38 +0000 (15:59 -0700)
if bandwidth is not set from Zebra  use speed as
   bandwidth for ospfv3 route cost.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospf6d/ospf6_interface.c

index 8cfed81a810b318131651c0017fcceea9d83cc7f..8e01cb43794309460b1acc91686603396e2e0b29 100644 (file)
@@ -117,8 +117,17 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
        u_int32_t cost;
        u_int32_t bw, refbw;
 
-       bw = oi->interface->bandwidth ? oi->interface->bandwidth
-                                     : OSPF6_INTERFACE_BANDWIDTH;
+       /* interface speed and bw can be 0 in some platforms,
+        * use ospf default bw. If bw is configured then it would
+        * be used.
+        */
+       if (!oi->interface->bandwidth && oi->interface->speed) {
+               bw = oi->interface->speed;
+       } else {
+               bw = oi->interface->bandwidth ? oi->interface->bandwidth
+                       : OSPF6_INTERFACE_BANDWIDTH;
+       }
+
        refbw = ospf6 ? ospf6->ref_bandwidth : OSPF6_REFERENCE_BANDWIDTH;
 
        /* A specifed ip ospf cost overrides a calculated one. */