Conversation
added 2 commits
January 30, 2026 11:24
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the DNS configuration logic in WSL to simplify the codebase and adopt modern DNS resolver configuration standards. The main changes eliminate unnecessary caching in HostDnsInfo and standardize on the 'search' directive instead of the obsolete 'domain' directive for DNS suffixes.
Changes:
- Converted HostDnsInfo::GetDnsSettings and related methods to static functions, removing instance state (cached adapter addresses, mutex, UpdateNetworkInformation method, and DnsUpdateHelper class)
- Switched from using the obsolete 'domain' directive to the standard 'search' directive for DNS suffixes in resolv.conf, consistent with resolv.conf(5) specification
- Added support for configurable resolv.conf header options in VirtioProxy and NAT networking modes
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/NetworkTests.cpp | Updated test expectations to remove 'domain' directive and verify 'search' directive only |
| src/windows/service/exe/WslMirroredNetworking.h | Removed m_hostDnsInfo member variable (no longer needed with static methods) |
| src/windows/service/exe/WslMirroredNetworking.cpp | Updated to call static HostDnsInfo::GetDnsSettings instead of instance method |
| src/windows/service/exe/WslCoreVm.cpp | Added LX_INIT_RESOLVCONF_FULL_HEADER parameter when creating VirtioNetworking |
| src/windows/service/exe/LxssInstance.h | Removed m_dnsInfo member variable (no longer needed) |
| src/windows/service/exe/LxssInstance.cpp | Removed UpdateNetworkInformation call and updated to use static GetDnsSettings |
| src/windows/common/WslCoreHostDnsInfo.h | Made GetDnsSettings static, removed mutex and cached addresses, removed DnsUpdateHelper class, updated BuildDnsNotification signature |
| src/windows/common/WslCoreHostDnsInfo.cpp | Removed caching logic, updated BuildDnsNotification to only use 'search' directive with explanatory comments |
| src/windows/common/VirtioNetworking.h | Added m_dnsOptions parameter and removed m_dnsUpdateHelper member |
| src/windows/common/VirtioNetworking.cpp | Updated constructor to accept dnsOptions, replaced DnsUpdateHelper with static HostDnsInfo calls |
| src/windows/common/NatNetworking.h | Added dnsOptions parameter, replaced m_mirrorDnsInfo with m_useMirrorDnsSettings flag and m_dnsOptions |
| src/windows/common/NatNetworking.cpp | Simplified DNS update logic to use static methods, removed 'domain' directive handling and logging |
| src/linux/init/GnsEngine.cpp | Removed 'domain' directive processing, added documentation comments about using 'search' instead |
benhillis
commented
Jan 30, 2026
|
|
||
| VirtioNetworking::VirtioNetworking( | ||
| GnsChannel&& gnsChannel, bool enableLocalhostRelay, std::shared_ptr<GuestDeviceManager> guestDeviceManager, wil::shared_handle userToken) : | ||
| GnsChannel&& gnsChannel, bool enableLocalhostRelay, LPCWSTR dnsOptions, std::shared_ptr<GuestDeviceManager> guestDeviceManager, wil::shared_handle userToken) : |
Member
Author
There was a problem hiding this comment.
@OneBlue - I'm open to other options, but basically I just don't want the WSL header in /etc/resolv.conf when we are running WSLA.
OneBlue
approved these changes
Feb 2, 2026
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 PR refactors HostDnsInfo to make GetDnsSettings a static method, removing unnecessary state (cached adapter addresses, mutex, UpdateNetworkInformation(), and the DnsUpdateHelper class) since the cache was being populated and immediately consumed without reuse. It also standardizes on the search directive for DNS suffixes instead of the obsolete domain directive, per resolv.conf(5).
Additionally the option to supply a header for /etc/resolv.conf was added to virtioproxy and NAT networking modes.