You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, wgcf always generates WireGuard profiles with a fixed MTU of 1280. While this is a safe default, some network setups may benefit from a different MTU or from letting WireGuard determine it automatically.
This change allows users to customize or omit the MTU without manually editing the generated profile, while preserving the existing behavior by default.
Description
Adds support for custom MTU values when generating WireGuard profiles.
Usage:
wgcf generate --mtu 1420 # sets a custom MTU
wgcf generate --no-mtu # omits the MTU setting
The --mtu and --no-mtu flags are mutually exclusive and cannot be used together.
The default remains MTU = 1280 for backward compatibility.
Added tests for flag parsing and generated profile output.
I also considered validating MTU values against system-specific limits, but decided that this falls outside wgcf's responsibility, especially since valid MTU ranges may vary across systems. For now, only zero and negative values are rejected, leaving further validation to the user and the system.
Side note
Tried to keep this one consistent with the project's existing code style and structure, just like last time.
I've been thinking about this for a while: do we really need to preserve wgcf's existing MTU behavior for backward compatibility?
I'm personally torn between keeping the --no-mtu flag I implemented to preserve the default behavior of previous versions and using this as an opportunity to make a small breaking change in favor of a cleaner, more explicit CLI.
Ideally, the MTU setting would only be included when explicitly requested with --mtu, and omitted otherwise. This would make the behavior more predictable, without relying on implicit defaults or requiring a separate --no-mtu flag.
A similar approach was taken in the PR #637 for --keepalive, where the flag now requires an explicit value instead of relying on implicit behavior. I think this is a nice improvement in terms of CLI consistency and predictability.
I'd like to hear your thoughts on this before making a final decision. I'm happy to implement whichever approach we agree on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, wgcf always generates WireGuard profiles with a fixed MTU of 1280. While this is a safe default, some network setups may benefit from a different MTU or from letting WireGuard determine it automatically.
This change allows users to customize or omit the MTU without manually editing the generated profile, while preserving the existing behavior by default.
Description
Adds support for custom MTU values when generating WireGuard profiles.
Usage:
The
--mtuand--no-mtuflags are mutually exclusive and cannot be used together.The default remains
MTU = 1280for backward compatibility.Added tests for flag parsing and generated profile output.
I also considered validating MTU values against system-specific limits, but decided that this falls outside wgcf's responsibility, especially since valid MTU ranges may vary across systems. For now, only zero and negative values are rejected, leaving further validation to the user and the system.
Side note
Tried to keep this one consistent with the project's existing code style and structure, just like last time.
@ViRb3