Repository navigation
Conversation
MaxRink
marked this pull request as ready for review
October 30, 2026 14:11
Contributor
Author
|
The |
MaxRink
force-pushed
the
enhanced-route-refresh
branch
2 times, most recently
from
December 2, 2026 01:42
70b3785 to
f27d1c9
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved graceful-restart ordering and capability-gating issues can trigger premature refresh handling and route deletion, while stale-route cleanup leaves pre-policy BMP collectors out of sync.
3 open issues
What changed in this PR
Adds Enhanced Route Refresh support to GoBGP, addressing #3647 by removing routes a peer omits during refresh.
Changes:
- Advertises the capability and preserves BoRR/UPDATE/EoRR ordering.
- Adds stale-route cleanup, timeout handling, and graceful-restart guards.
- Tests refresh behavior and outgoing message ordering.
| File | Description |
|---|---|
pkg/server/server.go |
Handles refresh markers, cleanup, and timers. |
pkg/server/server_test.go |
Tests refresh cleanup and graceful-restart guards. |
pkg/server/peer.go |
Adds per-family timers and End-of-RIB checks. |
pkg/server/fsm.go |
Advertises support and preserves queued message ordering. |
pkg/server/fsm_test.go |
Tests marker ordering around UPDATEs. |
pkg/packet/bgp/bgp.go |
Defines route-refresh subtype constants. |
Review effort: Balanced
GoBGP did not send the Enhanced Route Refresh capability, so a peer refreshed its routes without the begin and end markers, and GoBGP did not remove the routes that a peer left out of a refresh (osrg#3647). FRR sends the capability by default. - The OPEN carries the capability next to route refresh. - When both sides sent it, a route refresh request is answered with BoRR, the routes of the family, and EoRR. A raw message in the outgoing queue goes out after the UPDATEs queued before it, also when the send loop coalesces paths. While our initial advertisement of the family is deferred (our own graceful restart, or the route target membership deferral), the request is left to that advertisement, which follows with its End-of-RIB: no BoRR before the End-of-RIB (Section 4). - A BoRR marks the peer's routes of the family stale in the Adj-RIB-In; at EoRR the routes that it did not send again are withdrawn and, as when the Adj-RIB-In is dropped, reported to the pre-policy Adj-RIB-In watchers (BMP). - RFC 7313 Section 4: "A BGP speaker MAY ignore any EoRR message received without a prior receipt of an associated BoRR message." Graceful restart marks routes stale in the same Adj-RIB-In, so such an EoRR is ignored and does not remove them. A BoRR from a peer that sent the graceful restart capability is ignored before its End-of-RIB for the family ("MUST ignore"), also when graceful restart is not configured on our side. - "An implementation MAY impose a locally configurable upper bound on how long it would retain any stale routes": when no EoRR follows within the neighbor's graceful restart stale-routes-time, or 360 s (FRR's default stalepath-time), the routes that are still stale are removed. An EoRR, the end of the session and the removal of the neighbor stop the timer. - Other subtypes, and BoRR/EoRR without the capability, are ignored and logged (Section 5). Not covered yet: the Section 5 length check of BoRR/EoRR messages, and BoRR/EoRR around a locally initiated refresh (soft reset out). Fixes osrg#3647 Signed-off-by: Maximilian Rink <maximilian.rink@telekom.de> Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
MaxRink
force-pushed
the
enhanced-route-refresh
branch
from
December 2, 2026 15:51
f27d1c9 to
03bfbd7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Support Enhanced Route Refresh (RFC 7313). Fixes #3647: GoBGP did not remove the routes that a peer left out of a refresh.
stale-routes-time, or 360 s (FRR's defaultstalepath-time), as Section 4 allows.Behaviour change: the capability is now always sent, like route refresh. A peer that advertises it and then does not re-send a route after its BoRR loses that route at EoRR or after the bound. I can add a per-neighbor knob if you prefer.
Not covered yet: the Section 5 length check of BoRR/EoRR (NOTIFICATION 7/1), and BoRR/EoRR around a locally initiated refresh (soft reset out). I would send those separately.
Tests:
TestEnhancedRouteRefresh(BoRR/routes/EoRR both ways),TestEnhancedRouteRefreshNoEoRR(bound),TestEnhancedRouteRefreshBoRRBeforeEoR,TestEnhancedRouteRefreshEoRRWithoutBoRR(fails without the gate), andTestSendMessageloop_MessageKeepsOrder; they pass with-race. Fourpkg/servertests fail on my machine with and without this change (TestDisableMrt,TestEBGPRouteStuck,TestRTCDeferralTimerRaceCondition,TestTcpAoUpdatePeerWithClosedConnection, macOS).Did you use an AI tool?
Yes. Claude Opus 5.5 helped write and review the change (the review found the EoRR/graceful restart interaction fixed above); the commit has an
Assisted-bytrailer. I have reviewed it and can answer questions about it.