-
Notifications
You must be signed in to change notification settings - Fork 1.7k
CLI: Initial support for DNS options #40138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/wsl-for-apps
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -293,6 +293,46 @@ void SetContainerOptionsFromArgs(CLIExecutionContext& context) | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| if (context.Args.Contains(ArgType::DNS)) | ||||||
| { | ||||||
| auto dnsServers = context.Args.GetAll<ArgType::DNS>(); | ||||||
| options.DnsServers.reserve(options.DnsServers.size() + dnsServers.size()); | ||||||
| for (const auto& value : dnsServers) | ||||||
| { | ||||||
| options.DnsServers.emplace_back(WideToMultiByte(value)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| if (context.Args.Contains(ArgType::DNSDomain)) | ||||||
| { | ||||||
| options.DnsDomain = WideToMultiByte(context.Args.Get<ArgType::DNSDomain>()); | ||||||
| } | ||||||
|
|
||||||
| if (context.Args.Contains(ArgType::DNSOption)) | ||||||
| { | ||||||
| auto dnsOptions = context.Args.GetAll<ArgType::DNSOption>(); | ||||||
| options.DnsOptions.reserve(options.DnsOptions.size() + dnsOptions.size()); | ||||||
| for (const auto& value : dnsOptions) | ||||||
| { | ||||||
| options.DnsOptions.emplace_back(WideToMultiByte(value)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| if (context.Args.Contains(ArgType::DNSSearch)) | ||||||
| { | ||||||
| auto dnsSearchDomains = context.Args.GetAll<ArgType::DNSSearch>(); | ||||||
| options.DnsSearchDomains.reserve(options.DnsSearchDomains.size() + dnsSearchDomains.size()); | ||||||
| for (const auto& value : dnsSearchDomains) | ||||||
| { | ||||||
| options.DnsSearchDomains.emplace_back(WideToMultiByte(value)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| if (context.Args.Contains(ArgType::NoDNS)) | ||||||
| { | ||||||
| options.NoDns = true; | ||||||
|
||||||
| options.NoDns = true; | |
| THROW_HR_MSG(E_NOTIMPL, "--no-dns is not currently supported."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--dns-domainis wired toWSLCContainerLauncher::SetDomainname()(DockerDomainnamefield), which sets the container domainname/hostname domain rather than resolv.conf DNS search/default-domain configuration. This appears inconsistent with the option name/description (“default DNS Domain”). Consider renaming the option to match Docker (--domainname) or changing the implementation to affect DNS resolution (e.g., viaDnsSearchDomains/resolv.conf semantics) so behavior matches the CLI surface.