diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 22 | ||||
-rw-r--r-- | test/system/500-networking.bats | 24 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/.gitignore | 1 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal.go | 9 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_nosysioctl.go | 10 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_sysioctl.go | 17 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_windows.go | 17 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
10 files changed, 81 insertions, 27 deletions
@@ -5,7 +5,7 @@ go 1.16 require ( github.com/BurntSushi/toml v1.0.0 github.com/blang/semver v3.5.1+incompatible - github.com/buger/goterm v1.0.1 + github.com/buger/goterm v1.0.4 github.com/checkpoint-restore/checkpointctl v0.0.0-20211204171957-54b4ebfdb681 github.com/checkpoint-restore/go-criu/v5 v5.3.0 github.com/container-orchestrated-devices/container-device-interface v0.0.0-20220111162300-46367ec063fd @@ -175,8 +175,8 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dR github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/breml/bidichk v0.1.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/buger/goterm v1.0.1 h1:kSgw3jcjYUzC0Uh/eG8ULjccuz353solup27lUH8Zug= -github.com/buger/goterm v1.0.1/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE= +github.com/buger/goterm v1.0.4 h1:Z9YvGmOih81P0FbVtEYTFF6YsSgxSUKEhf/f9bTMXbY= +github.com/buger/goterm v1.0.4/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 86d8586d0..95f1634a8 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -2099,38 +2099,38 @@ func (c *Container) generateResolvConf() (string, error) { } dnsServers := append(dns, c.config.DNSServer...) // If the user provided dns, it trumps all; then dns masq; then resolv.conf + var search []string switch { case len(dnsServers) > 0: - // We store DNS servers as net.IP, so need to convert to string for _, server := range dnsServers { nameservers = append(nameservers, server.String()) } - case len(networkNameServers) > 0: - nameservers = append(nameservers, networkNameServers...) default: // Make a new resolv.conf - nameservers = resolvconf.GetNameservers(resolv.Content) - // slirp4netns has a built in DNS server. + // first add the nameservers from the networks status + nameservers = append(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. if c.config.NetMode.IsSlirp4netns() { slirp4netnsDNS, err := GetSlirp4netnsDNS(c.slirp4netnsSubnet) if err != nil { logrus.Warn("Failed to determine Slirp4netns DNS: ", err.Error()) } else { - nameservers = append([]string{slirp4netnsDNS.String()}, nameservers...) + nameservers = append(nameservers, slirp4netnsDNS.String()) } } + nameservers = append(nameservers, resolvconf.GetNameservers(resolv.Content)...) } - var search []string - if len(c.config.DNSSearch) > 0 || len(c.runtime.config.Containers.DNSSearches) > 0 || len(networkSearchDomains) > 0 { + if len(c.config.DNSSearch) > 0 || len(c.runtime.config.Containers.DNSSearches) > 0 { if !util.StringInSlice(".", c.config.DNSSearch) { - search = c.runtime.config.Containers.DNSSearches + search = append(search, c.runtime.config.Containers.DNSSearches...) search = append(search, c.config.DNSSearch...) - search = append(search, networkSearchDomains...) } } else { - search = resolvconf.GetSearchDomains(resolv.Content) + search = append(search, resolvconf.GetSearchDomains(resolv.Content)...) } var options []string diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index 9b39ebf97..4b1a22981 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -609,9 +609,27 @@ load helpers "8.8.8.8", ] EOF - CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE grep "example.com" /etc/resolv.conf - CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE grep $searchIP /etc/resolv.conf - is "$output" "nameserver $searchIP" "Should only be one $searchIP not multiple" + + local nl=" +" + + CONTAINERS_CONF=$containersconf run_podman run --rm $IMAGE cat /etc/resolv.conf + is "$output" "search example.com$nl.*" "correct seach domain" + is "$output" ".*nameserver 1.1.1.1${nl}nameserver $searchIP${nl}nameserver 1.0.0.1${nl}nameserver 8.8.8.8" "nameserver order is correct" + + # create network with dns + local netname=testnet-$(random_string 10) + local subnet=$(random_rfc1918_subnet) + run_podman network create --subnet "$subnet.0/24" $netname + # custom server overwrites the network dns server + CONTAINERS_CONF=$containersconf run_podman run --network $netname --rm $IMAGE cat /etc/resolv.conf + is "$output" "search example.com$nl.*" "correct seach domain" + is "$output" ".*nameserver 1.1.1.1${nl}nameserver $searchIP${nl}nameserver 1.0.0.1${nl}nameserver 8.8.8.8" "nameserver order is correct" + + # we should use the integrated dns server + run_podman run --network $netname --rm $IMAGE cat /etc/resolv.conf + is "$output" "search dns.podman.*" "correct seach domain" + is "$output" ".*nameserver $subnet.1.*" "integrated dns nameserver is set" } # vim: filetype=sh diff --git a/vendor/github.com/buger/goterm/.gitignore b/vendor/github.com/buger/goterm/.gitignore index 1377554eb..986544fb0 100644 --- a/vendor/github.com/buger/goterm/.gitignore +++ b/vendor/github.com/buger/goterm/.gitignore @@ -1 +1,2 @@ *.swp +.idea
\ No newline at end of file diff --git a/vendor/github.com/buger/goterm/terminal.go b/vendor/github.com/buger/goterm/terminal.go index 1ba6493ad..d1e82085e 100644 --- a/vendor/github.com/buger/goterm/terminal.go +++ b/vendor/github.com/buger/goterm/terminal.go @@ -199,15 +199,6 @@ func Width() int { return int(ws.Col) } -// Height gets console height -func Height() int { - ws, err := getWinsize() - if err != nil { - return -1 - } - return int(ws.Row) -} - // CurrentHeight gets current height. Line count in Screen buffer. func CurrentHeight() int { return strings.Count(Screen.String(), "\n") diff --git a/vendor/github.com/buger/goterm/terminal_nosysioctl.go b/vendor/github.com/buger/goterm/terminal_nosysioctl.go index 9b988ffd5..f4f4d5efc 100644 --- a/vendor/github.com/buger/goterm/terminal_nosysioctl.go +++ b/vendor/github.com/buger/goterm/terminal_nosysioctl.go @@ -1,3 +1,4 @@ +//go:build plan9 || solaris // +build plan9 solaris package goterm @@ -10,3 +11,12 @@ func getWinsize() (*winsize, error) { return ws, nil } + +// Height gets console height +func Height() int { + ws, err := getWinsize() + if err != nil { + return -1 + } + return int(ws.Row) +} diff --git a/vendor/github.com/buger/goterm/terminal_sysioctl.go b/vendor/github.com/buger/goterm/terminal_sysioctl.go index 33148ede0..8b48b405c 100644 --- a/vendor/github.com/buger/goterm/terminal_sysioctl.go +++ b/vendor/github.com/buger/goterm/terminal_sysioctl.go @@ -1,8 +1,11 @@ +//go:build !windows && !plan9 && !solaris // +build !windows,!plan9,!solaris package goterm import ( + "errors" + "math" "os" "golang.org/x/sys/unix" @@ -17,3 +20,17 @@ func getWinsize() (*unix.Winsize, error) { return ws, nil } + +// Height gets console height +func Height() int { + ws, err := getWinsize() + if err != nil { + // returns math.MinInt32 if we could not retrieve the height of console window, + // like VSCode debugging console + if errors.Is(err, unix.EOPNOTSUPP) { + return math.MinInt32 + } + return -1 + } + return int(ws.Row) +} diff --git a/vendor/github.com/buger/goterm/terminal_windows.go b/vendor/github.com/buger/goterm/terminal_windows.go index 37c56ae69..e8236b697 100644 --- a/vendor/github.com/buger/goterm/terminal_windows.go +++ b/vendor/github.com/buger/goterm/terminal_windows.go @@ -1,8 +1,11 @@ +//go:build windows // +build windows package goterm import ( + "errors" + "math" "os" "golang.org/x/sys/windows" @@ -21,3 +24,17 @@ func getWinsize() (*winsize, error) { return ws, nil } + +// Height gets console height +func Height() int { + ws, err := getWinsize() + if err != nil { + // returns math.MinInt32 if we could not retrieve the height of console window, + // like VSCode debugging console + if errors.Is(err, windows.WSAEOPNOTSUPP) { + return math.MinInt32 + } + return -1 + } + return int(ws.Row) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 1a2af971c..fb0a239bd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -41,7 +41,7 @@ github.com/beorn7/perks/quantile # github.com/blang/semver v3.5.1+incompatible ## explicit github.com/blang/semver -# github.com/buger/goterm v1.0.1 +# github.com/buger/goterm v1.0.4 ## explicit github.com/buger/goterm # github.com/cespare/xxhash/v2 v2.1.2 |