Repository navigation
fix(nat): Refuse an egress shard whose SID reuses a router's Node-ID - #746
Conversation
|
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:
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. |
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>
6124aa9 to
58b8eda
Compare
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
Fixes #711
🤖 Generated with Claude Code