Skip to content

fix(nat): Refuse an egress shard whose SID reuses a router's Node-ID - #746

Merged
privateip merged 2 commits into
mainfrom
fix/issue-711
Oct 6, 2026
Merged

privateip merged 2 commits into
mainfrom
fix/issue-711

Conversation

@privateip

@privateip privateip commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An egress shard claims every encapsulated packet whose Block and Node-ID match its SID, so a shard set up with a router's Block and Node-ID captures that router's tenant ingress and drops it.

The rule that shards need their own Node-ID was written down but never enforced.

The shard controller now checks the SID against every BGPRouter in the cluster, and on a match it leaves the datapath empty, withdraws the advertisement, and reports the shard as not programmed with a reason naming the router.

A clash with an address that no BGPRouter carries is still not detected.

Test plan

  • A shard sharing a Block and Node-ID with a router on its own node, or on any other node, is refused and never advertised
  • A shard on the same Block with its own Node-ID still translates
  • Moving the router off the shard's Node-ID programs the shard without a restart
  • Unit tests and lint pass

Fixes #711

🤖 Generated with Claude Code

@privateip privateip self-assigned this Oct 6, 2026
@privateip
privateip marked this pull request as ready for review October 6, 2026 12:00
@privateip
privateip requested a review from a team as a code owner October 6, 2026 12:00
@privateip
privateip enabled auto-merge October 6, 2026 12:00
@privateip

Copy link
Copy Markdown
Contributor Author

pr-conventions-reviewer: VERDICT merge. Findings: commit subject 68 chars (warning, skipped by session); summary five sentences (warning, applied); identifiers in body (nit, applied); overlap with open PRs #597/#745/#613/#580 on docs/nat/configuration.md and nat.c (warning, informational, rebase whichever lands second); program doc comment does not parse (nit, applied). Ran: gh pr view, git diff --stat and diff of nat.c and the controller, gh pr list of open PRs.

pr-adversary: VERDICT merge, no findings. Verified conflict handling clears the datapath, sets Programmed=False/LocatorConflict and withdraws the advertisement; lab shard Node-IDs 0x2002/0x2003 do not collide with router Node-IDs 4097-4099; RBAC grants cluster-wide bgprouters list/watch; router watch re-enqueues this node's shards. Ran: go test -race ./internal/controller/ -run EgressShard, diffs, grep over rbac and containerlab resources. Did not exercise the live lab.

Findings applied:

  • Summary rewritten to four sentences (removed identifiers Programmed=False and LocatorConflict)
  • Program function doc comment fixed to read more clearly

Commit: docs: Fix the program doc comment in the egress shard controller

CI: all checks passed (Build, Lint, Unit Tests, E2E Tests, publish images, Kustomize bundle).

Merge method: merge. The base branch ruleset requires an approving review, code owner review, and approval of the last push, with stale reviews dismissed on push, so auto-merge waits for a human approval.

ecv
ecv previously approved these changes Oct 6, 2026
privateip and others added 2 commits October 6, 2026 10:16
An egress shard's XDP program claims every encapsulated packet whose top 64 bits, the Block and Node-ID, match its SID. A shard configured with a BGPRouter's Block and Node-ID therefore captures that router's tenant ingress and the galactic-vrf sidecar's return traffic, and drops what it cannot translate. The reservation rule was documented in the datapath and the controller, but nothing enforced it.

The EgressShard reconciler now compares the shard SID's /64 against srv6.NodeSIDBase for every BGPRouter in the cluster before programming the datapath. On a match it clears the datapath and reports Programmed=False with reason LocatorConflict, naming the router. A refused shard publishes no identity, so its BGPAdvertisement is withdrawn. Routers with no locator or Node-ID, or an invalid one, own no uSID identity and are skipped.

Every BGPRouter is checked rather than only the shard's own node's, because the shard SID is advertised fabric-wide. The BGPRouter watch now enqueues this node's shards on any router change in any namespace, so creating a conflicting router unprograms the shard and resolving the conflict programs it again. broadcastToShardRequests had no other caller and is removed.

The reason constant is local to this repo, like ShardConflict, because the EgressShard API types live in the network module. A collision with a uSID identity that no BGPRouter carries is still not detected.

Fixes #711

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the awkward "Neither is" phrasing with a clearer "is refused too".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@privateip
privateip merged commit 3b22a2c into main Oct 6, 2026
21 of 22 checks passed
@privateip
privateip deleted the fix/issue-711 branch October 6, 2026 16:13
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.

Egress shard can capture tenant ingress

3 participants