]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: fix DR election race on startup 18057/head
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 6 Feb 2025 22:28:50 +0000 (19:28 -0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Feb 2025 03:42:37 +0000 (03:42 +0000)
In case interface address is learnt during configuration, make sure to
run DR election when configuring PIM/PIM passive on interface.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 86445246062583197d4a6dff7b8c74003cd8049d)

pimd/pim_nb_config.c

index 637780ca0f318222e95d33fc09484c0f8920e785..9a5f6f2de9b659555b25b6c7d0b1c7dc7203fe3d 100644 (file)
@@ -1755,6 +1755,11 @@ int lib_interface_pim_address_family_pim_enable_modify(struct nb_cb_modify_args
                                         ifp->name);
                                return NB_ERR_INCONSISTENCY;
                        }
+
+                       /* Trigger election in case it was never run before */
+                       pim_ifp = ifp->info;
+                       if (pim_addr_is_any(pim_ifp->pim_dr_addr))
+                               pim_if_dr_election(ifp);
                } else {
                        pim_ifp = ifp->info;
                        if (!pim_ifp)
@@ -1788,6 +1793,10 @@ int lib_interface_pim_address_family_pim_passive_enable_modify(
                pim_ifp = ifp->info;
                pim_ifp->pim_passive_enable =
                        yang_dnode_get_bool(args->dnode, NULL);
+
+               /* Trigger election in case it was never run before */
+               if (pim_ifp->pim_passive_enable && pim_addr_is_any(pim_ifp->pim_dr_addr))
+                       pim_if_dr_election(ifp);
                break;
        }