]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: Fix setting interface ipv6 ospf6 cost value (LSA hooks were never called)
authorJuergen Kammer <j.kammer@eurodata.de>
Tue, 7 Nov 2017 08:38:22 +0000 (09:38 +0100)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 Nov 2017 15:49:46 +0000 (10:49 -0500)
Fixes: #1420
Signed-off-by: Juergen Kammer <j.kammer@eurodata.de>
If the ipv6 ospf6 cost on an interface is changed, no recalculation of routes happens, though the interface structure is updated with the new value. The new cost will be used later, when LSA hooks are called for any other reason.

Diagnosis:
The DEFUN for the config command sets oi->cost and calls ospf6_interface_recalculate_cost(oi) whenever there is a change in the supplied value. ospf6_interface_recalculate_cost then gets the new cost for the interface by calling ospf6_interface_get_cost(oi), which returns oi->cost if a cost is manually set (i.e. we get the value we just set). ospf6_interface_recalculate_cost only calls the LSA hooks if there is a change - which obviously never happens if we compare the new value with itself.

ospf6d/ospf6_interface.c

index f237e4bef3ac9060db911303888786fca77174f2..98f93b06e67431fc0b6e1865088324aa93b479df 100644 (file)
@@ -144,15 +144,8 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
        return cost;
 }
 
-static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi)
+static void ospf6_interface_force_recalculate_cost(struct ospf6_interface *oi)
 {
-       u_int32_t newcost;
-
-       newcost = ospf6_interface_get_cost(oi);
-       if (newcost == oi->cost)
-               return;
-       oi->cost = newcost;
-
        /* update cost held in route_connected list in ospf6_interface */
        ospf6_interface_connected_route_update(oi->interface);
 
@@ -166,6 +159,18 @@ static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi)
        }
 }
 
+static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi)
+{
+       u_int32_t newcost;
+
+       newcost = ospf6_interface_get_cost(oi);
+       if (newcost == oi->cost)
+               return;
+       oi->cost = newcost;
+
+       ospf6_interface_force_recalculate_cost(oi);
+}
+
 /* Create new ospf6 interface structure */
 struct ospf6_interface *ospf6_interface_create(struct interface *ifp)
 {
@@ -1207,7 +1212,7 @@ DEFUN (ipv6_ospf6_cost,
        oi->cost = lcost;
        SET_FLAG(oi->flag, OSPF6_INTERFACE_NOAUTOCOST);
 
-       ospf6_interface_recalculate_cost(oi);
+       ospf6_interface_force_recalculate_cost(oi);
 
        return CMD_SUCCESS;
 }