summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-12-03 09:16:31 -0800
committerGitHub <noreply@github.com>2019-12-03 09:16:31 -0800
commit5c3af009c6027429d60f6e73bf3ade346ec3d410 (patch)
tree986b40e770c91bff8d0bfb7892e0a9c1ef1eb5a8 /libpod
parent748de3c52cdf408a59ae7f492d16daaeb7fecbd0 (diff)
parentb0b9103cca15278c064e058bbd96139d70acfcd5 (diff)
downloadpodman-5c3af009c6027429d60f6e73bf3ade346ec3d410.tar.gz
podman-5c3af009c6027429d60f6e73bf3ade346ec3d410.tar.bz2
podman-5c3af009c6027429d60f6e73bf3ade346ec3d410.zip
Merge pull request #4629 from mheon/fix_indirect_netnsctr_lookup
Allow chained network namespace containers
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go2
-rw-r--r--libpod/container_internal_linux.go21
2 files changed, 19 insertions, 4 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 4f7fc067e..d978e4e38 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1146,7 +1146,7 @@ func (c *Container) NetworkDisabled() (bool, error) {
if err != nil {
return false, err
}
- return networkDisabled(container)
+ return container.NetworkDisabled()
}
return networkDisabled(c)
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 586de0776..1b0570998 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -1016,9 +1016,24 @@ func (c *Container) makeBindMounts() error {
// We want /etc/resolv.conf and /etc/hosts from the
// other container. Unless we're not creating both of
// them.
- depCtr, err := c.runtime.state.Container(c.config.NetNsCtr)
- if err != nil {
- return errors.Wrapf(err, "error fetching dependency %s of container %s", c.config.NetNsCtr, c.ID())
+ var (
+ depCtr *Container
+ nextCtr string
+ )
+
+ // I don't like infinite loops, but I don't think there's
+ // a serious risk of looping dependencies - too many
+ // protections against that elsewhere.
+ nextCtr = c.config.NetNsCtr
+ for {
+ depCtr, err = c.runtime.state.Container(nextCtr)
+ if err != nil {
+ return errors.Wrapf(err, "error fetching dependency %s of container %s", c.config.NetNsCtr, c.ID())
+ }
+ nextCtr = depCtr.config.NetNsCtr
+ if nextCtr == "" {
+ break
+ }
}
// We need that container's bind mounts