]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospf6d: fix missing cost change
authoranlan_cs <vic.lan@pica8.com>
Tue, 9 Aug 2022 00:41:22 +0000 (20:41 -0400)
committeranlan_cs <vic.lan@pica8.com>
Thu, 11 Aug 2022 12:12:30 +0000 (08:12 -0400)
After all needed interfaces ( for example: interface "a1", vrf "vrf1", and
"a1" is binded to "vrf1" ) are ready/created, then restart/start frr. zebra
at startup will call `netlink_interface()` to process all interfaces and notify
all clients, but its calling `get_iflink_speed()` maybe fails for unexpected
order of the coming interfaces: when processing "a1", "vrf1" maybe is unknown
at that time. `if_zebra_speed_update()` timer is introduced to deal with this
order problem.

Currently only ospfd and ospf6d deal with this speed change to recalculated
route cost. ospfd can deal with this change, but ospf6d will wrongly missed it.

Since both `ipv6 ospf6 cost COST` and `auto-cost reference-bandwidth COST` are
not set, cost of this ospf6 interface should be calculated with interface
speed, but it is wrongly kept to `10`, which is based on interface speed being
`0` for it missed speed change. Further, ECMP function becomes invalid after
restart frr, beacuse some ospf6 interfaces of one ECMP are wrongly with cost
`10`.

To avoid missing, recalculate cost for ospf6 interfaces based on potentially
changed speed.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
ospf6d/ospf6_interface.c

index efa5d2b7ab91392ea02a4300d48a36594724efef..9bc81398c66ec81c9d11af7d5de481e474217f3b 100644 (file)
@@ -1719,8 +1719,11 @@ void ospf6_interface_start(struct ospf6_interface *oi)
        if (oi->area_id_format == OSPF6_AREA_FMT_UNSET)
                return;
 
-       if (oi->area)
+       if (oi->area) {
+               /* Recompute cost */
+               ospf6_interface_recalculate_cost(oi);
                return;
+       }
 
        ospf6 = oi->interface->vrf->info;
        if (!ospf6)