]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: allow a bsr with higher priority to take over
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 23 Oct 2024 19:14:58 +0000 (14:14 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sun, 27 Oct 2024 19:12:49 +0000 (19:12 +0000)
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit 4e74183d0f35fcb28f4dd8b88920b0426a426e3f)

pimd/pim_bsm.c

index 115aec893335bad11e2d7e198e13c364d1bfa641..a44e4e08f3d5ff8db1f2505dc944ec43302a440b 100644 (file)
@@ -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");