DNS: Simplify dns logic and switch to using 'search' instead of 'domain' which is obsolete. (#14133)

* DNS: Simplify dns logic and switch to using 'search' instead of 'domain'
which is obsolete.

* add optional header for natnetworking

* format

* extend configuration test for virtioproxy networking mode

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This commit is contained in:
Ben Hillis
2026-02-02 16:06:46 -08:00
committed by GitHub
parent b8e9351958
commit 8aadbb4da5
13 changed files with 67 additions and 131 deletions

View File

@@ -1037,7 +1037,6 @@ class NetworkTests
wsl::shared::hns::DNS dns;
dns.ServerList = L"1.1.1.1,1.1.1.2";
dns.Domain = L"microsoft.com";
dns.Search = L"foo.microsoft.com,bar.microsoft.com";
dns.Options = LX_INIT_RESOLVCONF_FULL_HEADER;
RunGns(dns, ModifyRequestType::Update, GuestEndpointResourceType::DNS);
@@ -1047,7 +1046,6 @@ class NetworkTests
const std::wstring expected = std::wstring(LX_INIT_RESOLVCONF_FULL_HEADER) +
L"nameserver 1.1.1.1\n"
L"nameserver 1.1.1.2\n"
L"domain microsoft.com\n"
L"search foo.microsoft.com bar.microsoft.com\n";
VERIFY_ARE_EQUAL(expected, out.c_str());
}
@@ -4612,6 +4610,9 @@ class VirtioProxyTests
const std::wregex pattern(L"(.|\\n)*nameserver [0-9. ]+(.|\\n)*");
VERIFY_IS_TRUE(std::regex_match(out, pattern));
// Verify that /etc/resolv.conf contains a 'search' line with DNS suffixes
VERIFY_IS_TRUE(out.find(L"search ") != std::wstring::npos);
}
TEST_METHOD(GuestPortIsReleased)