summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-16 22:03:49 +0200
committerGitHub <noreply@github.com>2019-09-16 22:03:49 +0200
commit0014d6cf6d9e5d588e0eed47db7908cf8be9afe1 (patch)
tree36455b43b3f0a6317beeb6c146f0b12657a889aa
parent1f5514ea551b12041346763a951bbe4a2f5fc3c3 (diff)
parent7c3428de26f12c6c31985310d785200f7c212d09 (diff)
downloadpodman-0014d6cf6d9e5d588e0eed47db7908cf8be9afe1.tar.gz
podman-0014d6cf6d9e5d588e0eed47db7908cf8be9afe1.tar.bz2
podman-0014d6cf6d9e5d588e0eed47db7908cf8be9afe1.zip
Merge pull request #4038 from giuseppe/enable-sandbox-slirp4netns
networking: use --enable-sandbox if available
-rw-r--r--libpod/networking_linux.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index fd14b2f73..67dd0150b 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -127,13 +127,13 @@ type slirp4netnsCmd struct {
Args slirp4netnsCmdArg `json:"arguments"`
}
-func checkSlirpFlags(path string) (bool, bool, error) {
+func checkSlirpFlags(path string) (bool, bool, bool, error) {
cmd := exec.Command(path, "--help")
out, err := cmd.CombinedOutput()
if err != nil {
- return false, false, err
+ return false, false, false, err
}
- return strings.Contains(string(out), "--disable-host-loopback"), strings.Contains(string(out), "--mtu"), nil
+ return strings.Contains(string(out), "--disable-host-loopback"), strings.Contains(string(out), "--mtu"), strings.Contains(string(out), "--enable-sandbox"), nil
}
// Configure the network namespace for a rootless container
@@ -166,7 +166,7 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
if havePortMapping {
cmdArgs = append(cmdArgs, "--api-socket", apiSocket, fmt.Sprintf("%d", ctr.state.PID))
}
- dhp, mtu, err := checkSlirpFlags(path)
+ dhp, mtu, sandbox, err := checkSlirpFlags(path)
if err != nil {
return errors.Wrapf(err, "error checking slirp4netns binary %s", path)
}
@@ -176,6 +176,9 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
if mtu {
cmdArgs = append(cmdArgs, "--mtu", "65520")
}
+ if sandbox {
+ cmdArgs = append(cmdArgs, "--enable-sandbox")
+ }
cmdArgs = append(cmdArgs, "-c", "-e", "3", "-r", "4", fmt.Sprintf("%d", ctr.state.PID), "tap0")
cmd := exec.Command(path, cmdArgs...)