pimd: fix elected BSR not updating when priority changes#22465
Conversation
Greptile SummaryThis PR fixes a bug where an elected BSR silently ignored its own priority increases. The root cause was
Confidence Score: 5/5The change is safe to merge: it adds a narrowly scoped guard inside The fix is minimal and correct. It updates No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Op as Operator
participant BSR as r2 (BSR_ELECTED)
participant r1 as r1 (Neighbour)
Note over BSR: current_bsr_prio = 250, cand_bsr_prio = 250
Op->>BSR: configure priority 255
BSR->>BSR: pim_cand_bsr_apply()
Note over BSR: current_bsr_prio(250) NOT > cand_bsr_prio(255), does NOT early-return
BSR->>BSR: pim_cand_bsr_trigger()
Note over BSR: current_bsr == run_addr, state == BSR_ELECTED, priorities differ
BSR->>BSR: "current_bsr_prio = 255"
BSR->>BSR: "pim_bsm_generate() - free stale frags, rebuild bsr_prio=255, pim_bsm_changed()"
BSR-->>r1: "BSM (bsr_prio=255)"
Note over r1: Updates current_bsr_prio = 255
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Op as Operator
participant BSR as r2 (BSR_ELECTED)
participant r1 as r1 (Neighbour)
Note over BSR: current_bsr_prio = 250, cand_bsr_prio = 250
Op->>BSR: configure priority 255
BSR->>BSR: pim_cand_bsr_apply()
Note over BSR: current_bsr_prio(250) NOT > cand_bsr_prio(255), does NOT early-return
BSR->>BSR: pim_cand_bsr_trigger()
Note over BSR: current_bsr == run_addr, state == BSR_ELECTED, priorities differ
BSR->>BSR: "current_bsr_prio = 255"
BSR->>BSR: "pim_bsm_generate() - free stale frags, rebuild bsr_prio=255, pim_bsm_changed()"
BSR-->>r1: "BSM (bsr_prio=255)"
Note over r1: Updates current_bsr_prio = 255
Reviews (4): Last reviewed commit: "tests: pim_cand_rp_bsr: add elected BSR ..." | Re-trigger Greptile |
When the elected BSR changes its own priority, the change was silently ignored. This happened because pim_cand_bsr_trigger() returned early when current_bsr matched our own address, without checking if the priority had changed. Fix by updating current_bsr_prio and regenerating BSM immediately when the elected BSR's priority changes. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
12e965b to
4288fce
Compare
|
@greptileai review |
Add test_pim_elected_bsr_priority_change to verify that when an elected BSR changes its own priority, the change takes effect immediately. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
4288fce to
8f1d5ef
Compare
|
@greptileai review |
|
@merifyio backport stable/10.7 stable/10.6 |
|
Hi, @Jafaral: Did you try to trigger backport? There was a typo in the command: "@merifyio" vs "@Mergifyio"? |
|
@Mergifyio backport stable/10.7 stable/10.6 |
✅ Backports have been createdDetails
|
Thanks! I fixed it. |
When the elected BSR changes its own priority, the change was silently
ignored. This happened because pim_cand_bsr_trigger() returned early
when current_bsr matched our own address, without checking if the
priority had changed.
Fix by updating current_bsr_prio and regenerating BSM immediately when
the elected BSR's priority changes.