summaryrefslogtreecommitdiff
path: root/libpod/networking_slirp4netns.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/networking_slirp4netns.go')
-rw-r--r--libpod/networking_slirp4netns.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go
index a09027b72..a5c035757 100644
--- a/libpod/networking_slirp4netns.go
+++ b/libpod/networking_slirp4netns.go
@@ -615,14 +615,21 @@ func getRootlessPortChildIP(c *Container) string {
return slirp4netnsIP.String()
}
- for _, r := range c.state.NetworkStatus {
- for _, i := range r.IPs {
- ipv4 := i.Address.IP.To4()
- if ipv4 != nil {
- return ipv4.String()
+ var ipv6 net.IP
+ for _, status := range c.getNetworkStatus() {
+ for _, netInt := range status.Interfaces {
+ for _, netAddress := range netInt.Networks {
+ ipv4 := netAddress.Subnet.IP.To4()
+ if ipv4 != nil {
+ return ipv4.String()
+ }
+ ipv6 = netAddress.Subnet.IP
}
}
}
+ if ipv6 != nil {
+ return ipv6.String()
+ }
return ""
}