Skip to content

fix(cni): reserve the IPv6 pool subnet containing the gateway address - #267

Merged
privateip merged 1 commit into
mainfrom
fix/ipv6-pool-gateway-reservation
Jul 30, 2026
Merged

fix(cni): reserve the IPv6 pool subnet containing the gateway address#267
privateip merged 1 commit into
mainfrom
fix/ipv6-pool-gateway-reservation

Conversation

@privateip

Copy link
Copy Markdown
Contributor

Summary

  • PoolAllocator (used for IPv6 endpoint IPAM) could hand out the /96 tile containing the region's own gateway address (::1) to the first endpoint allocated from a pool.
  • Since the design's addressing plan (datum-cloud/enhancementsarchitecture/design/network/addressing/tenant.md) reserves the remainder of an endpoint's /96 for that endpoint to self-assign to secondary IPs/containers/pods, that endpoint could self-assign the gateway's own address — colliding with the address every other endpoint in the region routes its default route through.
  • IPv4PoolAllocator already reserves its network/gateway/second-to-last/broadcast addresses (see reservedAddresses()); PoolAllocator now reserves the gateway's containing /96 subnet the same way, so it's never handed out by Allocate.

Test plan

  • go build ./...
  • go test ./internal/cni/...
  • go vet ./internal/cni/...
  • golangci-lint run ./internal/cni/...
  • Added TestPoolAllocatorReservesGatewaySubnet, which allocates 1,000 subnets from the pool and asserts the gateway's reserved /96 is never returned by Allocate and is never reported allocated by IsAllocated.

🤖 Generated with Claude Code

PoolAllocator handed out the /96 tile containing the region's own
gateway (::1) to the first endpoint allocated from a pool, letting
that endpoint self-assign the gateway's address to one of its own
secondary/pod addresses and collide with the address every other
endpoint's default route points at. IPv4PoolAllocator already
reserved its network/gateway/broadcast addresses; PoolAllocator now
reserves the gateway's containing subnet the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@privateip
privateip requested a review from a team as a code owner July 30, 2026 13:22
@privateip
privateip requested a review from JoseSzycho July 30, 2026 13:22
@privateip
privateip merged commit 1f45945 into main Jul 30, 2026
8 checks passed
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.

2 participants