Skip to content

CLI: Add --ipv6 to network create - #41303

Open
David Bennett (dkbennett) wants to merge 2 commits into
masterfrom
user/dkbennett/networkipv6
Open

CLI: Add --ipv6 to network create#41303
David Bennett (dkbennett) wants to merge 2 commits into
masterfrom
user/dkbennett/networkipv6

Conversation

@dkbennett

@dkbennett David Bennett (dkbennett) commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary of the Pull Request

Add Docker-compatible --ipv6 support to wslc network create.

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

  • Plumb --ipv6 through the CLI, session API, and Docker network-create request.
  • Report Docker's EnableIPv6 state through network inspect.
  • Preserve IPv6 state when recovering managed networks.
  • Add an end-to-end test for outbound IPv6 connectivity.
  • Share Docker session test helpers across e2e tests.

Validation Steps Performed

  • Full x64 Debug build.
  • WSLCE2ENetworkCreateTests: 17/17 passed.
  • Affected warning test passed.

Copilot AI lite review requested due to automatic review settings August 10, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 --ipv6 flag to wslc network create and pass it through to the session’s Docker network-create request (EnableIPv6).
  • Report EnableIPv6 in network inspect output and preserve it in cached/recovered managed network metadata.
  • Add an E2E test covering --ipv6 network 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.

@dkbennett
David Bennett (dkbennett) marked this pull request as ready for review August 10, 2026 19:03
Copilot AI review requested due to automatic review settings August 11, 2026 01:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 --gateway when 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

  • RunDockerInSession trims trailing whitespace using find_last_not_of(...) + 1 without handling the case where the output is empty or all-whitespace. In that case find_last_not_of returns npos, + 1 wraps, and erase() will throw/out-of-range, which can make tests flaky (e.g., docker logs can 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 Ipv6Gateway for the client to connect to, but the network is created without specifying a gateway. Docker may choose a different gateway than fd00:172:53::1, which would make this test fail intermittently. Specify --gateway when creating the network (or derive the gateway from network 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});

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.

2 participants