]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: fix DR election race on startup
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 6 Feb 2025 22:28:50 +0000 (19:28 -0300)
committerton31337 <3352707+ton31337@users.noreply.github.com>
Mon, 10 Feb 2025 07:34:49 +0000 (07:34 +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 be0be8588b3094ff43e255b2b11259b6bc2faf9e..0c3626cb9055d5dcf6db4a485aea5477b5add49f 100644 (file)
@@ -1582,6 +1582,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)
@@ -1615,6 +1620,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;
        }