wslc: implement dns tunneling for virtio proxy networking mode#40104
Merged
benhillis merged 3 commits intofeature/wsl-for-appsfrom Apr 7, 2026
Merged
wslc: implement dns tunneling for virtio proxy networking mode#40104benhillis merged 3 commits intofeature/wsl-for-appsfrom
benhillis merged 3 commits intofeature/wsl-for-appsfrom
Conversation
7daa758 to
f7a52d8
Compare
Contributor
There was a problem hiding this comment.
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 fromWslCoreVmand wslc’sHcsVirtualMachine. - 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.
f7a52d8 to
c2546a0
Compare
OneBlue
approved these changes
Apr 6, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
benhillis
commented
Apr 7, 2026
| 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"); |
Member
Author
There was a problem hiding this comment.
Decided to make asking for dns tunneling non-fatal.
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.
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.