diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-11-08 20:35:22 +0100 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-11-09 15:58:57 +0100 |
commit | 216e2cb36679abfcca869bed110b73e816ff9bf4 (patch) | |
tree | 1e60a90adce1588d26dc9f4c7d86f482c25777e7 /libpod/container_internal.go | |
parent | d0a44755c75763d2f5c656dca15b6bb928c961c4 (diff) | |
download | podman-216e2cb36679abfcca869bed110b73e816ff9bf4.tar.gz podman-216e2cb36679abfcca869bed110b73e816ff9bf4.tar.bz2 podman-216e2cb36679abfcca869bed110b73e816ff9bf4.zip |
Fix rootless networking with userns and ports
A rootless container created with a custom userns and forwarded ports
did not work. I refactored the network setup to make the setup logic
more clear.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index fbc2c1f38..64fe99132 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -290,7 +290,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err // setup slirp4netns again because slirp4netns will die when conmon exits if c.config.NetMode.IsSlirp4netns() { - err := c.runtime.setupSlirp4netns(c) + err := c.runtime.setupSlirp4netns(c, c.state.NetNS) if err != nil { return false, err } @@ -299,7 +299,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err // setup rootlesskit port forwarder again since it dies when conmon exits // we use rootlesskit port forwarder only as rootless and when bridge network is used if rootless.IsRootless() && c.config.NetMode.IsBridge() && len(c.config.PortMappings) > 0 { - err := c.runtime.setupRootlessPortMappingViaRLK(c, c.state.NetNS.Path()) + err := c.runtime.setupRootlessPortMappingViaRLK(c, c.state.NetNS.Path(), c.state.NetworkStatus) if err != nil { return false, err } @@ -999,9 +999,6 @@ func (c *Container) completeNetworkSetup() error { if err := c.syncContainer(); err != nil { return err } - if c.config.NetMode.IsSlirp4netns() { - return c.runtime.setupSlirp4netns(c) - } if err := c.runtime.setupNetNS(c); err != nil { return err } |