Skip to content

Add networking mode setting as fallback#14564

Merged
yao-msft merged 4 commits intofeature/wsl-for-appsfrom
user/yaosun/networksetting
Mar 30, 2026
Merged

Add networking mode setting as fallback#14564
yao-msft merged 4 commits intofeature/wsl-for-appsfrom
user/yaosun/networksetting

Conversation

@yao-msft
Copy link
Copy Markdown

Summary of the Pull Request

Added session networking setting as temp fallback if virtionet has issues. As it's only temporary, we did not add the setting to default template. The setting may be removed once we fixed the virtionet issue.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Manually tested the changes. As this change is only temporary, test was not updated.

Copilot AI review requested due to automatic review settings March 28, 2026 02:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a user-configurable session networking mode to WSLC as a temporary fallback mechanism, allowing users to switch away from the current virtio-proxy (“virtionet”) mode if needed.

Changes:

  • Introduce session.networkingMode user setting (validated from YAML into WSLCNetworkingMode).
  • Wire SessionOptions::Default() networking mode to the user setting instead of a hardcoded value.
  • Minor settings plumbing tweaks: use _1MB constant for memory conversion; avoid overwriting an existing settings file when opening settings on “Default” type.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/windows/wslc/settings/UserSettings.h Adds SessionNetworkingMode to the settings enum/mapping and includes wslc.h for WSLCNetworkingMode.
src/windows/wslc/settings/UserSettings.cpp Implements YAML validation for session.networkingMode; uses _1MB; avoids resetting settings file if it already exists.
src/windows/wslc/services/SessionModel.cpp Uses the new setting for SessionOptions::Default().NetworkingMode.

@ptrivedi
Copy link
Copy Markdown

lgtm, once the comments are resolved

Copilot AI review requested due to automatic review settings March 30, 2026 18:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/windows/wslc/settings/UserSettings.cpp:264

  • PrepareToShellExecuteFile() no longer creates/writes the default template for all UserSettingsType::Default cases; it now only does so when the settings file is missing. Please add a unit test to lock in the intended behavior (especially that an existing-but-unparseable settings.yaml is not overwritten).
void UserSettings::PrepareToShellExecuteFile() const
{
    if (m_type == UserSettingsType::Default && !std::filesystem::exists(m_settingsPath))
    {
        // First run — create the directory and write the commented-out defaults template.
        Reset();
    }

{
return WSLCNetworkingModeNAT;
}
if (value == "virtioproxy")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I would have a small preference for virtionet here, since that's how we've been describing it so far. What do you think @benhillis ?

@yao-msft yao-msft merged commit 9c978e2 into feature/wsl-for-apps Mar 30, 2026
10 checks passed
@yao-msft yao-msft deleted the user/yaosun/networksetting branch March 30, 2026 20:15
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.

5 participants