Skip to content

fix(mesh): avoid NAT between allowed location IPs - #521

Open
JSap0914 wants to merge 1 commit into
squat:mainfrom
JSap0914:fix/same-location-nat
Open

fix(mesh): avoid NAT between allowed location IPs#521
JSap0914 wants to merge 1 commit into
squat:mainfrom
JSap0914:fix/same-location-nat

Conversation

@JSap0914

@JSap0914 JSap0914 commented Jul 15, 2026

Copy link
Copy Markdown

What

  • add KILO-NAT return rules for traffic between allowed location CIDRs in the local segment
  • keep IPv4 and IPv6 rule pairs within the same protocol family
  • add a regression test for disjoint same-location CIDRs

Why

Traffic between two allowedLocationIPs CIDRs in the same location currently enters KILO-NAT and falls through to MASQUERADE. Returning before the final NAT rule preserves the original source address for traffic that remains within the site.

Fixes #496

Tests

  • docker run --rm -v "$PWD:/src" -w /src golang:1.25.0 go test -mod=vendor ./pkg/mesh -run ^'TestRulesDoNotNATBetweenAllowedLocationIPs$' -count=1
  • docker run --rm -v "$PWD:/src" -w /src golang:1.25.0 go test -mod=vendor ./pkg/mesh -count=1
  • docker run --rm -v "$PWD:/src" -w /src golang:1.25.0 go test -mod=vendor -race ./...
  • docker run --rm -v "$PWD:/src" -w /src golang:1.25.0 go vet -mod=vendor ./...
  • docker run --rm -v "$PWD:/src" -w /src golangci/golangci-lint:v2.12.2 golangci-lint run --modules-download-mode=vendor ./...

Add source-and-destination RETURN rules for allowed location CIDRs in the local segment so traffic between disjoint site networks does not fall through to MASQUERADE.
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.

bug(mesh): MASQUERADE applied to traffic between disjoint allowedLocationIPs CIDRs within same location

1 participant