ip: preserve connected routes during protocol replay - #703
Draft
hcaldicott wants to merge 1 commit into
Draft
Conversation
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can route each action level your way: inline, summary, both, or drop |
rjarry
requested changes
Aug 17, 2026
rjarry
left a comment
Collaborator
There was a problem hiding this comment.
Hey Harrison,
Your check is a bit loose. See how to make it more robust below.
Also could you remove any mention that you were assisted by AI? It does not bring much value and we prefer to keep the git history leaner.
Thanks!
hcaldicott
force-pushed
the
fix/connected-routes
branch
from
August 20, 2026 00:18
3b4929b to
b973e2e
Compare
Author
Good pickups - I will address these and re-run my lab tests! |
During control-plane replay, a routing daemon can briefly advertise a connected prefix before it has learned the interface address, then withdraw it again once it reconciles. route4_add() replaced the address-owned connected route with the protocol route, so the later withdrawal removed the only route to the prefix while the address stayed configured, cutting off the connected network until the address was re-added. Add is_addr_owned_route() which checks that the route's RIB origin is internal and that its nexthop carries the local address flags. Accept protocol adds for such prefixes as a silent no-op and refuse deleting them with EBUSY. Deletions resolve their nexthop with an exact-prefix lookup first so the nexthop type of a covering route is never used to delete a more specific prefix; the previous longest-prefix lookup remains as the fallback when no exact entry exists. Add a smoke test replaying the add/withdraw cycle over configured IPv4 and IPv6 addresses, checking the withdrawal is refused and the connected routes survive. Signed-off-by: Harrison Caldicott <harrison@itsfubar.com.au>
hcaldicott
force-pushed
the
fix/connected-routes
branch
from
August 20, 2026 00:52
b973e2e to
25cac2c
Compare
hcaldicott
marked this pull request as draft
August 20, 2026 00:59
Author
|
I have updated the PR. I am now rebuilding our physical lab on this to re-test the corrected behaviour. Converting back to a draft until my testing is completed. |
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.
During control-plane replay, a routing daemon can briefly advertise a
connected prefix before it has learned the interface address, then
withdraw it again once it reconciles.
route4_add()replaces theaddress-owned connected route with the protocol route, so the later
withdrawal removes the only route to the prefix while the address stays
configured — the connected network is unreachable until the address is
removed and re-added.
This change treats address-owned connected routes as authoritative:
protocol adds for such prefixes are accepted as a silent no-op, and API
deletes of internal-origin routes are refused the same way. Deletions now
resolve their nexthop with an exact-prefix lookup first, so the nexthop
type of a covering route is never used to delete a more specific prefix;
the previous longest-prefix lookup remains as the fallback when no exact
entry exists. Same handling for both address families.
Found while integrating FRR restart handling for EVPN multihoming (#698),
but the race only needs a routing daemon replaying routes over a
configured address.
Testing
connected_route_ownership_test.shreplays theadd/withdraw cycle over configured IPv4 and IPv6 addresses and asserts
the connected routes survive with their
linkorigin.main): the test fails at thefirst assertion — after add/withdraw,
172.16.0.0/24is gone from theRIB entirely.
ip_loadbalance_test.shconfirms ordinary route add/del and ECMPbehaviour is unchanged (AlmaLinux 9 container, arm64).
Related: #698