Skip to content

fix: check existing routes before installing pod subnet route#177

Merged
privateip merged 1 commit into
mainfrom
fix/issue-158
Jun 30, 2026
Merged

fix: check existing routes before installing pod subnet route#177
privateip merged 1 commit into
mainfrom
fix/issue-158

Conversation

@privateip

Copy link
Copy Markdown
Contributor

configureHostVethGateway used netlink.RouteReplace to install the pod-subnet route in the VRF table, which silently overwrote any existing route without warning. Replace it with a pre-flight check that lists existing routes, compares them for conflicts, and uses RouteAdd with an EEXIST guard for safe idempotency.

  • check for existing routes with the same destination before installing
  • return a clear error when an existing route has a different gateway
  • skip installation when the route already matches desired attributes
  • use RouteAdd instead of RouteReplace to prevent silent overwrites
  • extract routeConflicts as a testable pure function
  • add unit tests covering all conflict detection scenarios

fixes #158

configureHostVethGateway used netlink.RouteReplace to install the
pod-subnet route in the VRF table, which silently overwrote any
existing route without warning. Replace it with a pre-flight check
that lists existing routes, compares them for conflicts, and uses
RouteAdd with an EEXIST guard for safe idempotency.

- check for existing routes with the same destination before installing
- return a clear error when an existing route has a different gateway
- skip installation when the route already matches desired attributes
- use RouteAdd instead of RouteReplace to prevent silent overwrites
- extract routeConflicts as a testable pure function
- add unit tests covering all conflict detection scenarios

fixes #158
@privateip privateip requested a review from a team as a code owner June 30, 2026 20:33
@privateip privateip merged commit f59ed22 into main Jun 30, 2026
5 checks passed
@privateip privateip deleted the fix/issue-158 branch June 30, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2: configureHostVethGateway uses RouteReplace without checking existing state

2 participants