aboutsummaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-02-17 21:55:30 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-02-23 05:47:27 -0500
commitb87bdced1fa967846916b47cba5f093f72f3d11f (patch)
tree27342efd5d84839584260b9e2883e27ed8fbbd22 /libpod/options.go
parentb223d4e1367463a32eeeb31a4b9d8a351641d83c (diff)
downloadpodman-b87bdced1fa967846916b47cba5f093f72f3d11f.tar.gz
podman-b87bdced1fa967846916b47cba5f093f72f3d11f.tar.bz2
podman-b87bdced1fa967846916b47cba5f093f72f3d11f.zip
Fix up handling of user defined network namespaces
If user specifies network namespace and the /etc/netns/XXX/resolv.conf exists, we should use this rather then /etc/resolv.conf Also fail cleaner if the user specifies an invalid Network Namespace. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 9aa020b56..e22c81f91 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -904,10 +904,10 @@ func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netmo
}
ctr.config.PostConfigureNetNS = postConfigureNetNS
- ctr.config.CreateNetNS = true
+ ctr.config.NetMode = namespaces.NetworkMode(netmode)
+ ctr.config.CreateNetNS = !ctr.config.NetMode.IsUserDefined()
ctr.config.PortMappings = portMappings
ctr.config.Networks = networks
- ctr.config.NetMode = namespaces.NetworkMode(netmode)
return nil
}