From: Rafael Zalamena Date: Thu, 6 Feb 2025 22:28:50 +0000 (-0300) Subject: pimd: fix DR election race on startup X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=86445246062583197d4a6dff7b8c74003cd8049d;p=matthieu%2Ffrr.git pimd: fix DR election race on startup 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 --- diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 6af9291997..5203f78b92 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -2043,6 +2043,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) @@ -2076,6 +2081,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; }