summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-11-26 21:31:06 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2018-11-28 09:21:59 +0100
commit95f22a2ca055d6dec0281cee109375dc4fd9b78b (patch)
treefb916a4b5e4960cada05db5c57f2aae5175009f2 /libpod/options.go
parent4203df69aca13f14e43ad32a9b7ffb6cfb8c1016 (diff)
downloadpodman-95f22a2ca055d6dec0281cee109375dc4fd9b78b.tar.gz
podman-95f22a2ca055d6dec0281cee109375dc4fd9b78b.tar.bz2
podman-95f22a2ca055d6dec0281cee109375dc4fd9b78b.zip
network: allow slirp4netns mode also for root containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 507847d65..7f4e3ac6b 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -7,6 +7,7 @@ import (
"regexp"
"syscall"
+ "github.com/containers/libpod/pkg/namespaces"
"github.com/containers/storage"
"github.com/containers/storage/pkg/idtools"
"github.com/cri-o/ocicni/pkg/ocicni"
@@ -817,7 +818,7 @@ func WithDependencyCtrs(ctrs []*Container) CtrCreateOption {
// namespace with a minimal configuration.
// An optional array of port mappings can be provided.
// Conflicts with WithNetNSFrom().
-func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, networks []string) CtrCreateOption {
+func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netmode string, networks []string) CtrCreateOption {
return func(ctr *Container) error {
if ctr.valid {
return ErrCtrFinalized
@@ -831,6 +832,7 @@ func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netwo
ctr.config.CreateNetNS = true
ctr.config.PortMappings = portMappings
ctr.config.Networks = networks
+ ctr.config.NetMode = namespaces.NetworkMode(netmode)
return nil
}