CLI: Add --ipv6 to network create - #41303
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Docker-compatible --ipv6 support to wslc network create, plumbing the option through the CLI → service/model → session (Docker request), and ensures the IPv6 enablement state is surfaced via network inspect and preserved when recovering managed networks.
Changes:
- Add
--ipv6flag towslc network createand pass it through to the session’s Docker network-create request (EnableIPv6). - Report
EnableIPv6innetwork inspectoutput and preserve it in cached/recovered managed network metadata. - Add an E2E test covering
--ipv6network creation and inspection, plus a localized argument description string.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2ENetworkCreateTests.cpp | Adds assertions for default IPv6 state and a new E2E test for --ipv6. |
| src/windows/wslcsession/WSLCSession.cpp | Plumbs IPv6 enablement into Docker create request; caches/inspects/recovers EnableIPv6. |
| src/windows/wslcsession/WSLCNetworkMetadata.h | Extends cached network metadata with EnableIPv6. |
| src/windows/wslc/tasks/NetworkTasks.cpp | Reads --ipv6 flag and maps it into create options. |
| src/windows/wslc/services/NetworkService.cpp | Marshals EnableIPv6 into the COM options struct passed to the session. |
| src/windows/wslc/services/NetworkModel.h | Extends the create-network model options with EnableIPv6. |
| src/windows/wslc/commands/NetworkCreateCommand.cpp | Registers --ipv6 as a supported argument for network create. |
| src/windows/wslc/arguments/ArgumentDefinitions.h | Defines the ipv6 flag argument and hooks up localization. |
| src/windows/service/inc/wslc.idl | Extends WSLCNetworkOptions with EnableIPv6 for the internal COM contract. |
| src/windows/inc/wslc_schema.h | Extends inspect output schema to include EnableIPv6. |
| src/windows/inc/docker_schema.h | Extends Docker request/response schemas to include EnableIPv6. |
| localization/strings/en-US/Resources.resw | Adds localized description for the new --ipv6 argument. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (3)
test/windows/wslc/e2e/WSLCE2ENetworkCreateTests.cpp:161
- Same issue as above: this test assumes a fixed gateway address (
Ipv6Gateway) but the network is created without setting one. That makes the outbound-connectivity check sensitive to Docker's gateway selection. Pass--gatewaywhen creating the IPv6 network so the connect target matches the configured gateway.
auto result = RunWslc(std::format(L"network create --ipv6 --subnet {} {}", Ipv6Subnet, TestNetworkName));
result.Verify({.Stderr = L"", .ExitCode = 0});
test/windows/wslc/e2e/WSLCE2EHelpers.cpp:569
RunDockerInSessiontrims trailing whitespace usingfind_last_not_of(...) + 1without handling the case where the output is empty or all-whitespace. In that casefind_last_not_ofreturnsnpos,+ 1wraps, anderase()will throw/out-of-range, which can make tests flaky (e.g.,docker logscan legitimately return empty output while the container is starting).
auto output = result.Output[1];
output.erase(output.find_last_not_of(" \n\r") + 1);
return output;
test/windows/wslc/e2e/WSLCE2ENetworkCreateTests.cpp:145
- The test hard-codes
Ipv6Gatewayfor the client to connect to, but the network is created without specifying a gateway. Docker may choose a different gateway thanfd00:172:53::1, which would make this test fail intermittently. Specify--gatewaywhen creating the network (or derive the gateway fromnetwork inspect) so the connect target is guaranteed.
This issue also appears on line 160 of the same file.
auto result = RunWslc(std::format(L"network create --ipv6 --subnet {} {}", Ipv6Subnet, TestNetworkName));
result.Verify({.Stderr = L"", .ExitCode = 0});
Summary of the Pull Request
Add Docker-compatible
--ipv6support towslc network create.PR Checklist
Detailed Description of the Pull Request / Additional comments
--ipv6through the CLI, session API, and Docker network-create request.EnableIPv6state throughnetwork inspect.Validation Steps Performed
WSLCE2ENetworkCreateTests: 17/17 passed.