Skip to content

Commit

Permalink
libnetwork/pasta: pass --dns none
Browse files Browse the repository at this point in the history
We pass --no-map-gw to pasta and when run on a system with only
localhost resolvers pasta cannot find a valid nameserver in resolv.conf
it will print a warning. We do not use the dns functionality so the
warning is just bogus to podman users. Let's disable dns which is only
used for the dhcp option or --dns-forward which we do not use by
default. If a users sets such an option we use them instead.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
  • Loading branch information
Luap99 committed Feb 26, 2024
1 parent 3dc0ee1 commit 92784a2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libnetwork/pasta/pasta.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func Setup(opts *SetupOptions) error {
NoTCPNamespacePorts := true
NoUDPNamespacePorts := true
NoMapGW := true
NoDNS := true

path, err := opts.Config.FindHelperBinary(BinaryName, true)
if err != nil {
Expand Down Expand Up @@ -102,6 +103,8 @@ func Setup(opts *SetupOptions) error {
NoMapGW = false
// not an actual pasta(1) option
cmdArgs = append(cmdArgs[:i], cmdArgs[i+1:]...)
case "-D", "--dns", "--dns-forward":
NoDNS = false
}
}

Expand All @@ -120,6 +123,12 @@ func Setup(opts *SetupOptions) error {
if NoMapGW {
cmdArgs = append(cmdArgs, "--no-map-gw")
}
if NoDNS {
// disable pasta reading from /etc/resolv.conf which hides the
// "Couldn't get any nameserver address" warning when only
// localhost resolvers are configured.
cmdArgs = append(cmdArgs, "--dns", "none")
}

// always pass --quiet to silence the info output from pasta
cmdArgs = append(cmdArgs, "--quiet", "--netns", opts.Netns)
Expand Down

0 comments on commit 92784a2

Please sign in to comment.