summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2024-10-23 14:14:58 -0500
committerJafar Al-Gharaibeh <jafar@atcorp.com>2024-10-25 09:00:50 -0500
commit4e74183d0f35fcb28f4dd8b88920b0426a426e3f (patch)
tree6daec8dd8861598ce47a43f6eb72296341392219
parent8fbd88c5a73ec9a6d88b8fd310a943a6765caf8a (diff)
pimd: allow a bsr with higher priority to take over
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
-rw-r--r--pimd/pim_bsm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index 115aec8933..a44e4e08f3 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -1650,8 +1650,18 @@ static void pim_cand_bsr_pending_expire(struct event *t)
struct bsm_scope *scope = EVENT_ARG(t);
assertf(scope->state == BSR_PENDING, "state=%d", scope->state);
- assertf(pim_addr_is_any(scope->current_bsr), "current_bsr=%pPA",
- &scope->current_bsr);
+
+ if (!pim_addr_is_any(scope->current_bsr)) {
+ assertf(scope->cand_bsr_prio >= scope->current_bsr_prio,
+ "cand_bsr %pPA prio %u is less than current_bsr %pPA prio %u",
+ &scope->bsr_addrsel.run_addr, scope->current_bsr_prio, &scope->current_bsr,
+ scope->cand_bsr_prio);
+
+ if (scope->cand_bsr_prio == scope->current_bsr_prio)
+ assertf(pim_addr_cmp(scope->bsr_addrsel.run_addr, scope->current_bsr) > 0,
+ "cand_bsr %pPA < current_bsr %pPA", &scope->bsr_addrsel.run_addr,
+ &scope->current_bsr);
+ }
if (PIM_DEBUG_BSM)
zlog_debug("Elected BSR, wait expired without preferable BSMs");