Skip to content

Conversation

@benhillis
Copy link
Member

This change cleans up how DNS update messages are handled between NAT, Mirrored, and VirtioProxy networking modes. It also resolves an issue with VirtioProxy networking would update DNS information once and not send updates if the host information changed.

Copy link
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

This PR refactors DNS update handling across WSL networking modes (NAT, Mirrored, and VirtioProxy) to consolidate common logic and fix a bug where VirtioProxy networking would only send DNS updates once during initialization and not when host DNS information changed.

Changes:

  • Introduced BuildDnsNotification() helper function to centralize DNS notification message construction from DnsInfo settings
  • Added DnsUpdateHelper class to fetch current DNS settings from the host
  • Removed DNS-related fields (DnsServers, DeviceName) from NetworkSettings struct as they are now fetched dynamically
  • Fixed VirtioProxy to track DNS changes and send updates when host DNS information changes via network connectivity callbacks

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/windows/common/WslCoreHostDnsInfo.h Added BuildDnsNotification() function declaration and DnsUpdateHelper class for fetching current DNS settings
src/windows/common/WslCoreHostDnsInfo.cpp Implemented BuildDnsNotification() to convert DnsInfo to hns::DNS notification and DnsUpdateHelper::GetCurrentDnsSettings()
src/windows/common/WslCoreNetworkEndpointSettings.h Removed DNS-related fields (DnsServers, DeviceName) from NetworkSettings struct and simplified constructor
src/windows/common/WslCoreNetworkEndpointSettings.cpp Removed DNS initialization code from GetHostEndpointSettings() as DNS is now fetched dynamically
src/windows/common/VirtioNetworking.h Changed DNS handling to use DnsUpdateHelper and track DNS state with m_trackedDnsSettings
src/windows/common/VirtioNetworking.cpp Implemented DNS change tracking and updates in RefreshGuestConnection() callback; refactored to use BuildDnsNotification()
src/windows/service/exe/WslMirroredNetworking.cpp Removed duplicate ConvertDnsInfoToHnsSettingsMsg() function; now uses shared BuildDnsNotification()
src/windows/common/NatNetworking.cpp Refactored to use BuildDnsNotification() instead of inline DNS notification construction

@benhillis benhillis enabled auto-merge (squash) January 27, 2026 16:17
@benhillis benhillis merged commit a057ee6 into master Jan 27, 2026
6 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