Skip to content

client: revert auto-allocate IP on connect when behind NAT (#3861)#3870

Merged
ben-dz merged 1 commit into
mainfrom
bdz/revert-nat-auto-allocate
Jun 10, 2026
Merged

client: revert auto-allocate IP on connect when behind NAT (#3861)#3870
ben-dz merged 1 commit into
mainfrom
bdz/revert-nat-auto-allocate

Conversation

@ben-dz

@ben-dz ben-dz commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Reverts client: auto-allocate IP on connect when behind NAT #3861 (105d9035): doublezero connect ibrl no longer auto-flips to IBRLWithAllocatedIP when the daemon's default-route source is an RFC1918 address.
  • The heuristic misfires on hosts behind 1:1 NAT — e.g. the chi-dn devnet QA hosts — where plain IBRL works. After today's daily deploy picked up the change, those hosts silently connected as a different user type with an allocated dz_ip, and devnet QA TestQA_MultiTunnel/unicast_connectivity failed deterministically (route waits expect public-IP routes).
  • Beyond QA, the same silent user-type change would hit any NAT'd production client on the next release, so the detection needs to distinguish 1:1 NAT from address-translating NAT before re-landing.
  • Removes the behind_nat field from the daemon's /v2/status response and the CLI's NAT-aware connect path; explicit -a / --client-ip behavior is unchanged.
  • Targeted for a standalone v0.27.1 release (v0.27.0 is already tagged with the feature included).

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 2 +19 / -163 -144
Scaffolding 9 +3 / -52 -49
Tests 2 +1 / -117 -116
Docs 1 +3 / -0 +3
Total 14 +26 / -332 -306

Pure revert: net -306 lines, mostly removing the NAT-detection logic and its tests.

Key files (click to expand)

Testing Verification

  • cargo test -p doublezero: 145 tests pass (includes the connect command suite the revert touches).
  • go test ./client/doublezerod/internal/runtime/... ./client/doublezerod/internal/manager/...: pass.
  • make rust-lint clean in the dev container.
  • The revert auto-merged around client: auto-join authorized multicast groups on connect with no args #3864 (auto-join multicast groups), which landed in connect.rs afterward; only CHANGELOG.md needed manual resolution (v0.27.0 section kept as shipped history, revert noted under Unreleased).

The RFC1918 default-route heuristic misfires on hosts behind 1:1 NAT
(e.g. the chi-dn QA hosts), where plain IBRL works. The auto-flip
silently changes the user type to IBRLWithAllocatedIP and broke devnet
QA unicast connectivity. Revert until the detection can distinguish
1:1 NAT from address-translating NAT.

This reverts commit 105d903.
@ben-dz ben-dz enabled auto-merge (squash) June 10, 2026 18:42
@ben-dz ben-dz merged commit 52af58a into main Jun 10, 2026
33 checks passed
@ben-dz ben-dz deleted the bdz/revert-nat-auto-allocate branch June 10, 2026 18:52
@ben-dz ben-dz mentioned this pull request Jun 10, 2026
elitegreg pushed a commit that referenced this pull request Jun 10, 2026
## Summary of Changes
- Version bump to 0.27.1 for a standalone patch release carrying the
revert of the NAT auto-allocate behavior (#3861, reverted in #3870).
- Moves the revert note from Unreleased into a v0.27.1 changelog
section.

## Testing Verification
- Cargo.lock regenerated via `cargo update --workspace`; same 13/13 line
shape as the 0.27.0 bump.
ben-dz added a commit that referenced this pull request Jun 10, 2026
## Summary of Changes
- Skip the e2e and shreds-e2e suites on PRs where the suites add no
signal — version bumps and docs/RFC-only changes — so they don't burn
~20 minutes of self-hosted runner time building images and running the
full suite.
- A new gate step in each workflow's `setup` job inspects the PR's
changed files via the API. A PR qualifies only if every file is either
markdown (`*.md`, any path; renames/copies must come from markdown too,
since a rename also deletes the source path) or
`Cargo.toml`/`Cargo.lock` with diffs touching nothing but `version =
"..."` lines, with the two Cargo files changing together. A dependency
bump fails the check — `cargo update` changes Cargo.lock checksum/source
lines, an inline requirement change in Cargo.toml doesn't match the
version-line shape, and a requirement change that leaves the lock
untouched fails the pairing rule — as does any code file or an
API-truncated patch. All of those fall through to a normal e2e run.
Markdown is verified inert: no `.md` files are used as test fixtures,
embedded via `include_str!`, or read by e2e code.
- Because the gated matrix jobs never create their shard check runs, the
gate reports the required `e2e (shard 1-5)` / `shard-e2e (shard 1-4)`
contexts as successful on the PR head via the checks API (same pattern
the trusted fork-PR flow already uses), so branch protection doesn't
block the merge.
- The gate runs only on same-repo `pull_request` events; fork PRs,
pushes to main/hotfix, and trusted `workflow_dispatch` runs are
unaffected. Any gate error fails open to running e2e.

## Diff Breakdown
| Category     | Files | Lines (+/-) | Net  |
|--------------|-------|-------------|------|
| Config/build |     2 | +152 / -0   | +152 |

Workflow-only change; the same gate logic is added to both e2e
workflows.

<details>
<summary>Key files (click to expand)</summary>

- `.github/workflows/e2e.yml` — skip-gate step + early exit in the
existing `run-e2e` gate; reports `e2e (shard 1-5)` checks when skipping
- `.github/workflows/shreds-e2e.yml` — same gate; reports `shard-e2e
(shard 1-4)` checks when skipping

</details>

## Testing Verification
- Ran the gate's file-classification logic (extracted verbatim into a
node harness) against real PR data: #3874 (0.27.1 version bump)
correctly classifies as skippable; #3870 (code change) correctly runs
e2e.
- Synthetic dependency-bump cases all run e2e: `cargo update`-shaped
Cargo.lock diff (checksum lines); dependency requirement change in
Cargo.toml, both inline and multi-line-table form with the lock
untouched; lock-only version-line change.
- Synthetic markdown cases: new RFC added, RFC+README edits, markdown
deleted, markdown renamed from markdown, and version bump + RFC edit all
skip; markdown plus a code file, a file renamed from `.rs` to `.md`, and
a Cargo.lock with an API-omitted patch all run e2e.
- `actionlint` passes on both workflows.
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