Skip to content

fix(net): default WireGuard gateway and StartTunnel MTU to 1280 - #4816

Merged
dr-bonez merged 6 commits into
masterfrom
fix/wireguard-conservative-mtu
Nov 20, 2026
Merged

dr-bonez merged 6 commits into
masterfrom
fix/wireguard-conservative-mtu

Conversation

@helix-red

@helix-red helix-red commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

WireGuard tunnels now default to an MTU of 1280, the IPv6 minimum, wherever a config states none:

  • StartOS gateways. A WireGuard gateway added or updated with no MTU = line gets wireguard.mtu = 1280 instead of NetworkManager's automatic MTU. An explicit MTU = still wins, with the existing validation: at least 68, and at least 1280 when the config has an IPv6 address. Updating a gateway that was on the automatic MTU now changes its MTU, so NetworkManager reconnects it once rather than applying the change in place, which it cannot do for an MTU.
  • Existing StartOS gateways. On upgrade to 0.4.3, every saved WireGuard profile on NetworkManager's automatic MTU gets wireguard.mtu = 1280, and each active one reconnects once. No MTU could be set before MTU support (fix(gateway): honor WireGuard MTU on gateway import and update #4791), so an automatic MTU was never a user's choice; a profile with an explicit MTU is left alone. The change goes through nmcli connection modify, which keeps the profile's private key and preshared keys. Writing the settings back over D-Bus would need those secrets merged in by hand. A failure is logged as a warning and startup continues, so a NetworkManager problem cannot stop the server booting; a gateway that fails stays at 1420 until its config is updated. 0.4.3 has already shipped as release candidates, and master has since published two more 0.4.3 database steps to alpha: fix(core): keep a range's public IP on with its plain public domain across a renumber #4666's range grouping at revision 1, and fix(start-os): update re-added SSH keys in place and publish them to patch-db #4757's SSH-key move at revision 2. This PR raises the revision to 3, so every server already on 0.4.3, at revision 0, 1 or 2, runs this step once on its next boot. Re-running those database steps is harmless, since running either twice gives the same result.
  • StartTunnel. The wg-start-tunnel interface comes up at 1280, and every device config StartTunnel exports carries MTU = 1280. StartTunnel rewrites its interface config and restarts the interface on every sync, so existing installs move to 1280 at their next restart or update, and on any device or subnet change. The forwarded-TCP clamp sizes segments from the interface MTU, so TCP forwarded to devices now uses an MSS of 1240 instead of 1380.

Both products read one constant, WIREGUARD_DEFAULT_MTU in net/gateway.rs. The migration lives in version/v0_4_3.rs. net/gateway.rs only exposes the NetworkManager primitives it needs at crate visibility, and gains settings_uuid, now shared with the gateway update path. start-core's AGENTS.md now states the rule that migration code always lives in its version file.

Implementation diff: +129 / −22 lines in 5 files (excludes lockfiles, tests, docs, release notes, and changelog). Most of it is the migration in v0_4_3.rs. The count also leaves out the 8 lines in locales/i18n.yaml that add the warning message in five languages.

Why

#4788: a service published through StartTunnel stalled after the TLS Server Hello. The server's home connection runs through another WireGuard VPN, which leaves about 1340 bytes for StartTunnel's tunnel, so StartTunnel's 1420-byte packets were silently dropped while small ones got through. The user's pings fit this: 1200-byte pings were answered, 1392-byte pings were not. Setting wg-start-tunnel to 1280 by hand fixed it, but each re-sync reverted it. The TCP clamp already existed, but it trusts the interface MTU, so with 1420 configured it sized segments for 1420.

1280 is a chosen conservative value, not a measured one. It fits WireGuard nested inside one other WireGuard tunnel over IPv6, or two over IPv4, and keeps IPv6 usable through the tunnel. The cost is about 10% less payload per full-size packet on paths that could carry 1420. Deeper nesting still breaks. Automatic path-MTU detection, and a fragmenting shim for paths below 1280, are drafted as an AGCP extension in #4817. A saved per-install MTU override, the other part of #4788, is not in this PR.

Neighbors

  • StartWRT's VPN-client import accepts MTUs from 1280 to 1500, so StartTunnel configs carrying MTU = 1280 still import there. StartWRT's own WireGuard defaults are unchanged.
  • StartOS releases before fix(gateway): honor WireGuard MTU on gateway import and update #4791 ignore MTU = when importing a config, so they keep the automatic MTU even for new StartTunnel configs.

Testing

  • make start-core-test via helix-build on this branch's head (41e584f8d, after merging current master): 1886 passed, 0 failed, plus the ignored backup-worker suite (3 passed).
  • The updated unit tests check:
  • make start-core-format-check and Prettier on the changelog fragments pass.
  • Not exercised end to end: no StartOS box or StartTunnel VPS ran this build. That leaves the migration's nmcli calls against a live NetworkManager, the reconnect, and the nested-VPN case from WireGuard tunnel MTU can't be adapted to the path — add path-MTU detection plus a manual MTU setting in StartTunnel and StartOS gateways #4788 unverified.
  • CI on head 41e584f8d: all 38 checks that ran passed. These include start-core tests and man pages, generated bindings, formatting, StartWRT tests, and every OS image and migration-image build. The 21 deploy and image-variant jobs were skipped, as they are for every pull request.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

A WireGuard tunnel nested in another VPN, or on a path narrower than
1500 bytes, silently drops packets sized for the 1420-byte default:
large TLS flights stall while small requests succeed (#4788). Until
path-MTU detection lands, use the IPv6 minimum MTU wherever a WireGuard
config states none: StartOS gateways, StartTunnel's interface, and the
device configs StartTunnel exports. StartTunnel's forwarded-TCP MSS
clamp follows the interface MTU.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
helix-white
helix-white previously approved these changes Nov 20, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 1f962fcc7d239c8adeadb66ff119e16f2385313a. No blocking correctness findings.

Checked the shared MTU default through gateway parsing, NetworkManager settings, add/update callers, and StartTunnel's server/client configuration rendering. Explicit MTUs still win; updating an automatic-MTU gateway selects reactivation rather than the unsupported Reapply path. StartTunnel's startup and network-sync paths consume the rendered server config. The regression assertions cover the default, explicit override, reactivation decision, and both configuration templates.

git merge-tree --write-tree origin/master HEAD succeeds. Reviewed the available CI results; builds and test jobs were still pending. No builds or tests run during review.

The documented migration question remains a maintainer decision: existing StartOS profiles do not acquire this default until their configuration is updated. Approval covers that stated add/update scope, not an automatic migration.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red requested a review from dr-bonez November 20, 2026 01:47
Gateways added before MTU support sat on NetworkManager's automatic MTU,
which no user chose. 0.4.3's post_up now sets every saved WireGuard
profile without an explicit MTU to WIREGUARD_DEFAULT_MTU through nmcli,
which keeps the profile's secrets, and reconnects the active ones. A
failure is logged and startup continues. The migration revision bump
re-runs it on servers already at 0.4.3.

Migration code lives in its version file; start-core's AGENTS.md now
states that rule.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red

Copy link
Copy Markdown
Contributor Author

@dr-bonez decided existing gateways must be migrated: no MTU could be set before #4791, so an automatic MTU was never anyone's choice. 5f932fd78 adds the migration to 0.4.3's post_up, with migration revision 1 so servers already on 0.4.3 run it once. It sets every saved WireGuard profile on the automatic MTU to 1280 through nmcli (which keeps the profile's keys), reconnects the active ones, and leaves explicit MTUs alone. A failure only logs a warning; startup continues. At his direction the migration lives in version/v0_4_3.rs, and start-core's AGENTS.md now states that rule. I've updated the description to match. Re-requesting review since this adds behavior beyond what you approved.

helix-white
helix-white previously approved these changes Nov 20, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 5f932fd78f0e8d45bbb391876e985deac4a7bcc1. No blocking correctness findings in the migration added since my previous review.

Checked automatic-versus-explicit profile selection, the targeted nmcli connection modify operation, active-profile reactivation, continued attempts after per-profile failures, and warning-only startup behavior. The shared settings helpers preserve the existing gateway-update semantics. Revision 1 correctly requeues post_up for existing 0.4.3 revision-0 installations; the added regression covers that queueing exactly once. Migration code remains in its version file as requested.

The previous migration scope question is now resolved by the recorded maintainer decision and implementation. git merge-tree --write-tree origin/master HEAD succeeds. Available CI checks show no failures, with builds and tests still pending when inspected. No builds or tests run during review; live NetworkManager/reconnect verification remains unexecuted as disclosed in the description.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 20, 2026 02:25

Dismissed by Helix: the changes require a substantive PR brief update. The original approval covered gateway add/update and explicitly excluded automatic migration. The added 0.4.3 post_up migration changes saved automatic-MTU WireGuard profiles to 1280, reconnects active profiles, and uses migration revision 1 to run on existing 0.4.3 installations. This changes existing-install behavior and rollout, requiring replacement of the reviewed brief's statement that existing gateways remain unchanged until their configuration is updated.

…rvative-mtu

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

# Conflicts:
#	shared-libs/crates/start-core/src/version/mod.rs
#	shared-libs/crates/start-core/src/version/v0_4_3.rs
master published 0.4.3 revision 1 with the range-grouping up(). Revision
2 makes alpha servers already at revision 1 also run the WireGuard MTU
post_up; up() stays idempotent.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red

Copy link
Copy Markdown
Contributor Author

Merged current master, which conflicted in version/v0_4_3.rs and version/mod.rs. #4666 added its own 0.4.3 database step (range IP grouping) and raised 0.4.3's migration revision to 1.

make start-core-test: 1882 passed, 0 failed. The format check passes. The branch merges cleanly into master. I've updated the description. Re-requesting review.

helix-white
helix-white previously approved these changes Nov 20, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at c7ec6774b5267bb6f3c0790eaeba2633934ed0ec. No blocking findings since the previous approval.

Inspected 7976eacea with git show --remerge-diff: the resolution preserves master's range-grouping up() and its helpers/tests alongside the MTU post_up() and its helpers/tests. The gateway and StartTunnel implementations are unchanged from the previously reviewed head.

Revision 2 correctly requeues the MTU migration for existing 0.4.3 revision-1 installations as well as revision 0. Checked the migration loader/commit path, the expanded exactly-once queue test, and the retained range-grouping operation and idempotence assertion; rerunning that database step is consistent with its semantics.

git merge-tree --write-tree origin/master HEAD succeeds. CI was still pending when inspected; no builds or tests run during review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 20, 2026 04:42

Dismissed by Helix: the changes require a substantive PR brief update. The migration gate changes from revision 1 to 2. Existing 0.4.3 revision-1 installations, previously treated as complete, now rerun the range-grouping up() and queue the MTU post_up(). Although range grouping itself comes from master and the MTU implementation is unchanged, this changes rollout eligibility and migration replay. The reviewed brief must explain coverage of revision-1 installations and the idempotent replay of their existing database migration.

…rvative-mtu

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

# Conflicts:
#	shared-libs/crates/start-core/src/version/v0_4_3.rs
master published 0.4.3 revision 2 with the SSH key move. Revision 3
makes alpha servers already at revision 2 also run the WireGuard MTU
post_up; up() stays idempotent.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red

Copy link
Copy Markdown
Contributor Author

Merged current master again. #4757 also changed version/v0_4_3.rs: it added an SSH-key move to 0.4.3's up()/down() and raised the revision to 2.

make start-core-test: 1886 passed, 0 failed. The format check passes. The branch merges cleanly into master. I've updated the description. Re-requesting review.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 41e584f8db0f0edc89b44ec0d6ee6283836ef7c5. No blocking findings since the previous approval.

Inspected eb12f6ccb with git show --remerge-diff and compared its resolved migration against its master parent. The SSH-key up()/down() steps, helper and tests are preserved alongside the unchanged MTU post_up() implementation.

Revision 3 correctly queues the MTU step for existing 0.4.3 revision-2 installations. Checked the expanded exactly-once queue coverage for revisions 0, 1 and 2, and replay safety: the SSH move retains the existing destination key collection, while the range-grouping operation remains idempotent. The retained SSH tests cover metadata preservation, repeated application, rollback and migration before typed database decoding.

git merge-tree --write-tree origin/master HEAD succeeds. CI remained pending when inspected; no builds or tests run during review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 20, 2026 06:05

Dismissed by Helix: the changes require a substantive PR brief update. Raising the migration revision from 2 to 3 makes existing 0.4.3 revision-2 installations execute the MTU post_up(), whereas the reviewed head treated revision 2 as complete. This also replays the upstream SSH-key and range-grouping up() steps. The brief must update rollout coverage from revisions 0–1 to 0–2 and explain replay safety; this is a behavioral migration-gate change, not merely bookkeeping.

@dr-bonez
dr-bonez merged commit 40eff6b into master Nov 20, 2026
66 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants