]> git.proxmox.com 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)
committerJuergen Kammer <j.kammer@eurodata.de>
Tue, 7 Nov 2017 13:42:10 +0000 (14:42 +0100)
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 6b443127ca38b630c12b88194cae108b462837c0..b14739bb20908f61164ab4049ad34a180172bb93 100644 (file)
@@ -136,15 +136,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);
 
@@ -158,6 +151,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)
 {
@@ -1174,7 +1179,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;
 }