Skip to content

wslc: implement dns tunneling for virtio proxy networking mode#40104

Merged
benhillis merged 3 commits intofeature/wsl-for-appsfrom
user/benhill/virtio_dns_tunneling
Apr 7, 2026
Merged

wslc: implement dns tunneling for virtio proxy networking mode#40104
benhillis merged 3 commits intofeature/wsl-for-appsfrom
user/benhill/virtio_dns_tunneling

Conversation

@benhillis
Copy link
Copy Markdown
Member

@benhillis benhillis commented Apr 4, 2026

This change implements dns tunneling for the virtioproxy networking mode. This will go through the same path as dnstunneling for NAT until the built in dns support is fixed in the device host dll.

Copilot AI review requested due to automatic review settings April 4, 2026 03:06
@benhillis benhillis force-pushed the user/benhill/virtio_dns_tunneling branch from 7daa758 to f7a52d8 Compare April 4, 2026 03:08
@benhillis benhillis marked this pull request as ready for review April 4, 2026 03:08
@benhillis benhillis requested a review from a team as a code owner April 4, 2026 03:08
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

Implements DNS tunneling support when WSL is running in VirtioProxy networking mode, aligning wslc and the service/common networking stack so TCP DNS can be supported via a DNS tunneling socket rather than the NAT/ICS proxy behavior.

Changes:

  • Add a DNS-tunneling-socket path to the VirtioProxy networking engine (VirtioNetworking) and plumb the DNS hvsocket from WslCoreVm and wslc’s HcsVirtualMachine.
  • Add a wslc user setting (session.dnsTunneling) and wire it into session feature flags.
  • Extend Windows test coverage for VirtioProxy DNS tunneling and add more DNS-resolution validation in wslc tests.

Reviewed changes

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

Show a summary per file
File Description
test/windows/WSLCTests.cpp Expands networking validation to include DNS resolution checks; adds VirtioProxy+DNS-tunneling test.
test/windows/NetworkTests.cpp Adds VirtioProxy DNS-resolution test variants with DNS tunneling enabled.
src/windows/wslc/settings/UserSettings.h Introduces SessionDnsTunneling setting mapping (session.dnsTunneling).
src/windows/wslc/settings/UserSettings.cpp Adds validation hook for the new DNS tunneling user setting.
src/windows/wslc/services/SessionModel.cpp Converts session.dnsTunneling into WslcFeatureFlagsDnsTunneling in session settings.
src/windows/service/exe/WslCoreVm.cpp Enables VirtioProxy DNS tunneling support path and passes DNS socket into VirtioNetworking.
src/windows/service/exe/HcsVirtualMachine.h Stores NAT config as a member and includes config header to support lifetime needs.
src/windows/service/exe/HcsVirtualMachine.cpp Enables DNS tunneling for VirtioProxy by setting a Virtio flag and passing the DNS socket to VirtioNetworking.
src/windows/common/WslCoreConfig.cpp Allows DNS tunneling to remain enabled for VirtioProxy; refactors service-running detection.
src/windows/common/VirtioNetworking.h Adds DnsTunnelingSocket flag and an optional DnsResolver member; updates ctor signature to accept DNS socket.
src/windows/common/VirtioNetworking.cpp Validates DNS socket/flag consistency, constructs DnsResolver, and sets DNS settings for the socket-based tunneling case.
src/windows/common/helpers.hpp Declares new IsServiceRunning helper.
src/windows/common/helpers.cpp Implements IsServiceRunning used by config initialization logic.

This change implements dnstunneling for the virtio proxy networking mode. For now, this implementation uses the same socket-based approach, but in the fututure this will be moved over to the built-in dns support that is part of the wsldevicehost dll.
@benhillis benhillis force-pushed the user/benhill/virtio_dns_tunneling branch from f7a52d8 to c2546a0 Compare April 4, 2026 14:03
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 6, 2026 22:17
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 13 out of 13 changed files in this pull request and generated 4 comments.

VerifyDnsResolutionDig and VerifyDnsResolutionRecordTypes are dead
code — VerifyDnsQueries is the superset that covers all record types
and TCP/UDP modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
const auto result = wsl::core::networking::DnsResolver::LoadDnsResolverMethods();
if (FAILED(result))
{
LOG_HR_MSG(result, "Failed to load DNS resolver methods, DNS tunneling will be disabled");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Decided to make asking for dns tunneling non-fatal.

@benhillis benhillis enabled auto-merge (squash) April 7, 2026 01:09
@benhillis benhillis merged commit c223800 into feature/wsl-for-apps Apr 7, 2026
7 checks passed
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.

3 participants