diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-08-17 14:02:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 14:02:00 +0000 |
commit | c2f9ab1a1ae3adf0afb80faebead8fcc7a5b53d0 (patch) | |
tree | 9ab74df204c01b0989a863bac646c3a902080631 /libpod/container_internal_linux.go | |
parent | c90eec2700d2e00a4b8f1e06ca640c034af5a530 (diff) | |
parent | 1572420c3fbf8a8022faaa93848a7239037a77e4 (diff) | |
download | podman-c2f9ab1a1ae3adf0afb80faebead8fcc7a5b53d0.tar.gz podman-c2f9ab1a1ae3adf0afb80faebead8fcc7a5b53d0.tar.bz2 podman-c2f9ab1a1ae3adf0afb80faebead8fcc7a5b53d0.zip |
Merge pull request #15357 from dfr/freebsd-build
Add non-linux build stubs for libpod
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r-- | libpod/container_internal_linux.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 3c77cb18c..5c5fd471b 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -3228,3 +3228,28 @@ func (c *Container) ChangeHostPathOwnership(src string, recurse bool, uid, gid i } return chown.ChangeHostPathOwnership(src, recurse, uid, gid) } + +// If the container is rootless, set up the slirp4netns network +func (c *Container) setupRootlessNetwork() error { + // set up slirp4netns again because slirp4netns will die when conmon exits + if c.config.NetMode.IsSlirp4netns() { + err := c.runtime.setupSlirp4netns(c, c.state.NetNS) + if err != nil { + return err + } + } + + // set up 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(), c.state.NetworkStatus) + if err != nil { + return err + } + } + return nil +} + +func openDirectory(path string) (fd int, err error) { + return unix.Open(path, unix.O_RDONLY|unix.O_PATH, 0) +} |