← Back to Pull requests

bgp: avoid false cluster loops on plain iBGP sessions #626

Merged
nuclearcat merged 2 files (328 lines) on Sep 24, 2026 13:05 UTC
View on GitHub
nuclearcat nuclearcat commented on Sep 23, 2026 17:35 UTC
Author

Reproduced with an iBGP session without RR clients: an UPDATE whose CLUSTER_LIST contains the local router ID is incorrectly rejected. The session treated its router ID as a cluster ID even without local route reflection.

Build and check only effective local RR cluster IDs, consistent with RFC 4456, while preserving loop checks for client and non-client peers. Add active/passive wire and configuration regression tests using synthetic addresses and a private ASN.

Similar fix i noticed comitted last week in GoBGP: https://github.com/osrg/gobgp/commit/544c4beae3bd6f01f869a2b7037e4953560d34a0

Did you use an AI tool?

Assisted-by: OpenAI Codex

Diff: 328 lines (+314 / -14) across 2 files Reviewer: fujita Review duration: 1170m
All Vouch review confidence checks passed
Residual risk 0.10 = Change Risk (0.44) × (1 − Review Confidence (0.77)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 328 lines diff across 2 files
0.44
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.55 · 3 substantive comment(s)
0.55
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
76%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.347
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
5 items
fujita fujita commented on code on Sep 24, 2026 11:52 UTC
Code Review
daemon/src/event/tests/cluster_loop.rs:1
@@ -0,0 +1,249 @@
+use super::*;

We don't use a separate tests/ directory in this repo yet. Could you move these tests into the mod tests in mod.rs, next to the other RFC 4456 loop detection tests

fujita fujita requested changes on Sep 24, 2026 12:22 UTC
Changes Requested Reviewer

Two comments on the commit message:

  • "incorrectly rejected" is too strong, I think. FRR also rejects the route in the same situation, and the RFC is not clear about this case.

  • "as required by RFC 4456": RFC 4456 section 8 says "If the local CLUSTER_ID is found in the CLUSTER_LIST, the advertisement received SHOULD be ignored." It does not define the local CLUSTER_ID when cluster IDs are configured per peer. This patch uses the set of cluster IDs of the RR-client peers as the local CLUSTER_ID. That is a reasonable choice, and GoBGP 544c4bea does the same, but it is not required by the RFC. Please describe it as a choice, for example "use the cluster IDs of all RR-client peers as the local CLUSTER_ID".
  • The PR description says GoBGP made a similar fix. But GoBGP 544c4bea adds a CLUSTER_LIST check on import that GoBGP did not have before, so it fixes a missing check. This PR changes the definition of the local CLUSTER_ID instead, and the RFC is not clear about that definition. If you want to mention GoBGP, please say that this PR makes the behavior the same as GoBGP 544c4bea.

    nuclearcat nuclearcat commented on code on Sep 24, 2026 12:48 UTC
    Code Review
    daemon/src/event/tests/cluster_loop.rs:1
    @@ -0,0 +1,249 @@
    +use super::*;

    Updated commit message and tests. Thank you for review!

    fujita fujita commented on Sep 24, 2026 13:05 UTC
    Contributor

    Thanks!

    Reviewers
    Assignees
    nuclearcat nuclearcat
    Labels
    risk: low confidence: 76.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.1% (MEDIUM) · Higher = larger blast radius
    44.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 76.8% · Lower = rushed or shallow review
    76.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 10.2% · Safe to merge
    10.2%
    Repository