diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-01-24 16:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-24 16:16:10 +0100 |
commit | 479fc226044b745ecaafc2d5fa925afe6ca06de0 (patch) | |
tree | f9ff97ee6b9a31b485bba37b958a1650bd219f12 /libpod/networking_linux.go | |
parent | b6765c17e6d74430db30d382ac899d4fc888afd5 (diff) | |
parent | 0ba1942f261158b9526310aac7ee5f183a109440 (diff) | |
download | podman-479fc226044b745ecaafc2d5fa925afe6ca06de0.tar.gz podman-479fc226044b745ecaafc2d5fa925afe6ca06de0.tar.bz2 podman-479fc226044b745ecaafc2d5fa925afe6ca06de0.zip |
Merge pull request #9066 from giuseppe/set-source-to-net
networking: lookup child IP in networks
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r-- | libpod/networking_linux.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 09fdea496..ef2f034ab 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -550,13 +550,25 @@ func (r *Runtime) setupRootlessPortMappingViaRLK(ctr *Container, netnsPath strin } } + childIP := slirp4netnsIP +outer: + for _, r := range ctr.state.NetworkStatus { + for _, i := range r.IPs { + ipv4 := i.Address.IP.To4() + if ipv4 != nil { + childIP = ipv4.String() + break outer + } + } + } + cfg := rootlessport.Config{ Mappings: ctr.config.PortMappings, NetNSPath: netnsPath, ExitFD: 3, ReadyFD: 4, TmpDir: ctr.runtime.config.Engine.TmpDir, - ChildIP: slirp4netnsIP, + ChildIP: childIP, } cfgJSON, err := json.Marshal(cfg) if err != nil { |