summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-02-18 14:53:53 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-04-01 17:27:03 +0200
commit00b2ec5e6f8ad332411271df1bdd968493cab2c2 (patch)
tree69485fd451bdb144ce8914af23a746639b21a745 /libpod
parent54b588c07d05858c9bbc523eeff0badb85d53f76 (diff)
downloadpodman-00b2ec5e6f8ad332411271df1bdd968493cab2c2.tar.gz
podman-00b2ec5e6f8ad332411271df1bdd968493cab2c2.tar.bz2
podman-00b2ec5e6f8ad332411271df1bdd968493cab2c2.zip
Add rootless support for cni and --uidmap
This is supported with the new rootless cni logic. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go4
-rw-r--r--libpod/networking_linux.go7
2 files changed, 6 insertions, 5 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 106e2569b..a53027ab2 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -966,9 +966,7 @@ func (c *Container) completeNetworkSetup() error {
if err := c.syncContainer(); err != nil {
return err
}
- if rootless.IsRootless() {
- return c.runtime.setupRootlessNetNS(c)
- } else if c.config.NetMode.IsSlirp4netns() {
+ if c.config.NetMode.IsSlirp4netns() {
return c.runtime.setupSlirp4netns(c)
}
if err := c.runtime.setupNetNS(c); err != nil {
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index aac02d8cc..1bfb82cdb 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -972,8 +972,11 @@ func (r *Runtime) setupNetNS(ctr *Container) error {
if _, err := rand.Reader.Read(b); err != nil {
return errors.Wrapf(err, "failed to generate random netns name")
}
-
- nsPath := fmt.Sprintf("/run/netns/cni-%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
+ nsPath, err := netns.GetNSRunDir()
+ if err != nil {
+ return err
+ }
+ nsPath = filepath.Join(nsPath, fmt.Sprintf("cni-%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]))
if err := os.MkdirAll(filepath.Dir(nsPath), 0711); err != nil {
return err