Repository navigation
Description
Summary
Since #1461, galactic-nat pins state for each Local pair so that a restart keeps sessions translating: a native XDP link at /sys/fs/bpf/galactic-nat/links/local-<NAT end> (cmd/galactic-nat/workerlocal.go), plus rows in nat_local_pair, nat_local_return and nat_vlan_egress (internal/plumbing/ebpf/natmap/local.go).
That state is removed only while the Worker integration is running: per claim through Unprogram/detach, and as stale rows through Prune, which only cmd/galactic-nat/worker.go calls. The integration starts only when worker_socket is set and the datapath is enabled (cmd/galactic-nat/root.go). turnOffDatapath (cmd/galactic-nat/nat.go) clears the dispatcher slot but leaves the Local pins and rows, and there is no uninstall hook.
The lab case shows the gap. deploy/containerlab/scripts/verify-nat-local.sh removes the pins and deletes the map rows by hand during teardown, with a comment that names this gap.
Impact
When the integration is switched off, the datapath is set to disabled, or galactic-nat is uninstalled, the pinned XDP links stay attached to any pair that still exists. Local pairs then keep translating after the shard reports DatapathDisabled and its advertisement is withdrawn. That lasts until Worker withdraws the claims at session-lease expiry (120 s by default) and deletes the pairs. This is inferred from the code and the restart behavior; it was not measured for the disable case.
Afterwards, pins and rows keyed to deleted interfaces stay behind until a later start with the integration on runs Prune. No cross-tenant effect was found.
Expected behavior
Starting galactic-nat with the integration off or the datapath disabled removes its Local pins and rows, the same as Prune with an empty keep set. Uninstalling galactic-nat removes them as well, or the operations docs state the cleanup step.
Parent criterion
Part of #1430: NAT66 and NAT64 integrate with Local delivery and stop translating when the shard's datapath is disabled.
Acceptance
- Unit (
cmd/galactic-nat): withworker_socketempty, or the datapath disabled, startup calls the Local plumbing's Prune with an empty keep set (fake plumbing). - Root test: pins and rows left by a prior run are gone after such a start (kernel Local plumbing).
- Lab:
verify:nat-local-shard's teardown disables the datapath (or unsetsworker_socket), restarts galactic-nat, and passesverify-nat-local-clean.sh's pin and row checks before any manual removal. The manualrmandbpftooldeletes inverify-nat-local.share removed. -
task cipasses.
Activity
privateip commentedon Nov 21, 2026
Confirmed against
integration/galactic-workerat f32863f, from source:runCmdincmd/galactic-nat/root.gostarts the Worker integration only whenworker_socketis set and the datapath is enabled. No other branch touches Local state.turnOffDatapath(cmd/galactic-nat/nat.go) empties only the dispatcher slot.kernelLocal.Prune(cmd/galactic-nat/workerlocal.go) is called only fromworker.go, inside the running integration.Two more gaps, beyond the issue text:
Prunenever removesnat_vlan_egressrows, yetverify-nat-local-clean.shrequires that map to be empty.Prunefails if thelinkspin directory is missing.No runtime reproduction yet. The lab case will confirm the fix.
privateip commentedon Nov 21, 2026
Plan for the fix, on branch
fix/issue-1479againstintegration/galactic-worker:worker_socketis empty or the datapath is disabled, galactic-nat calls the Local plumbing'sPrunewith an empty keep set.nat_local_pair,nat_local_returnandnat_vlan_egressmaps. A pin that is missing counts as empty. Nothing is created on a node that never ran galactic-nat.turnOffDatapath.Prunealso clearsnat_vlan_egress. OnlykernelLocal.syncVLANswrites that map;nat.conly reads it. A missinglinksdirectory counts as empty.Prune(nil)runs, and the integration doesn't start, whenworker_socketis empty or the datapath is disabled. When both are on, the integration starts andPruneisn't called.verify-nat-local.shalready restarts galactic-nat withoutGALACTIC_NAT_WORKER_SOCKETduring teardown. Right after that restart, it now checks that the pins and rows are gone, while Local's pairs still exist. The manualrmandbpftooldeletes are removed.docs/nat/configuration.mddescribes the cleanup at startup and the step to take on uninstall.Behavior change: a restart with the integration off stops Local translation at once instead of at lease expiry. No API or config changes.
privateip commentedon Nov 21, 2026
Fixed by #1480, merged into
integration/galactic-workeras 252ce63.galactic-nat now removes its Local pair links and map rows when it starts with
worker_socketempty or the datapath disabled. The lab case showed them removed while 4 Local pairs still existed, with no manual cleanup. The uninstall step is indocs/nat/configuration.md.The change is not yet on
mainor in a release. It ships with the integration branch.fix(nat): remove Local pair state when Worker integration is off
fix(nat): remove Local pair state when Worker integration is off
fix(nat): remove Local pair state when Worker integration is off