Fix wslc create network filaure without driver specified#40788
Open
chemwolf6922 wants to merge 4 commits into
Open
Fix wslc create network filaure without driver specified#40788chemwolf6922 wants to merge 4 commits into
chemwolf6922 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes wslc network create failing when --driver is not provided by ensuring the CLI task always supplies a default network driver (bridge) to the underlying WSLC session API. This aligns runtime behavior with the CLI help text and enables the previously-disabled E2E coverage for the default-driver path.
Changes:
- Default
CreateNetworkOptions.Driverto"bridge"when--driveris omitted innetwork create. - Re-enable the E2E test that validates creating a network without specifying a driver.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2ENetworkCreateTests.cpp | Re-enables the default-driver network create E2E test and asserts the created network uses bridge. |
| src/windows/wslc/tasks/NetworkTasks.cpp | Ensures options.Driver is always populated (defaults to "bridge" when not specified). |
beena352
previously approved these changes
Jun 12, 2026
6 tasks
dkbennett
requested changes
Jun 12, 2026
dkbennett
left a comment
Member
There was a problem hiding this comment.
I don't think it is correct for the CLI to be setting a default if the service sets one. The service should handle that and the CLI should not be setting its own default.
Member
|
To add some additional context:
|
|
|
||
| std::string name = Options->Name; | ||
| std::string driver = Options->Driver; | ||
| std::string driver = (Options->Driver != nullptr && Options->Driver[0] != '\0') ? Options->Driver : WSLCBridgeNetworkDriver; |
| options.DriverOptsCount = 0; | ||
|
|
||
| for (const char* driver : {"overlay", "Bridge", ""}) | ||
| for (const char* driver : {"overlay", "Bridge"}) |
Contributor
Author
|
@OneBlue Do we want to allow "" being treated as default? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the Pull Request
The WSLCSession::CreateNetwork expects Options->Driver to be populated. However, when the driver is not specified in the cli. It's skipped and default to NULL. This PR populates it with the default "bridge" driver when not specified.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Enable test:
WSLCE2ETests::WSLCE2ENetworkCreateTests::WSLCE2E_Network_Create_DefaultDriver_Success