Skip to content

Commit

Permalink
libpod: set search domain independently of nameservers
Browse files Browse the repository at this point in the history
Set search domain irrespective of nameservers.

Signed-off-by: Aditya R <[email protected]>
  • Loading branch information
flouthoc committed Jan 22, 2023
1 parent 0624107 commit e2c44c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libpod/container_internal_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2010,18 +2010,18 @@ func (c *Container) generateResolvConf() error {
}
}
// If the user provided dns, it trumps all; then dns masq; then resolv.conf
var search []string
keepHostServers := false
if len(nameservers) == 0 {
keepHostServers = true
// first add the nameservers from the networks status
nameservers = networkNameServers
// when we add network dns server we also have to add the search domains
search = networkSearchDomains
// slirp4netns has a built in DNS forwarder.
nameservers = c.addSlirp4netnsDNS(nameservers)
}

// Set DNS search domains
search := networkSearchDomains

if len(c.config.DNSSearch) > 0 || len(c.runtime.config.Containers.DNSSearches) > 0 {
customSearch := make([]string, 0, len(c.config.DNSSearch)+len(c.runtime.config.Containers.DNSSearches))
customSearch = append(customSearch, c.runtime.config.Containers.DNSSearches...)
Expand Down

0 comments on commit e2c44c3

Please sign in to comment.