summaryrefslogtreecommitdiff
path: root/pkg/network/ip.go
diff options
context:
space:
mode:
authorAntonio Ojea <aojea@redhat.com>2020-08-14 11:19:02 +0200
committerAntonio Ojea <aojea@redhat.com>2020-08-15 12:11:01 +0200
commit07e3f1bba9674c0cb93a0fa260930bfebbf75728 (patch)
tree12a096d58c7903839eaf39ceb889415129e91426 /pkg/network/ip.go
parentd777a7bd5c920ce3cf06c4eba25068747dbc6b8f (diff)
downloadpodman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.gz
podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.bz2
podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.zip
podman support for IPv6 networks
podman containers using IPv6 were missing the default route, breaking deployments trying to use them. The problem is that the default route was hardcoded to IPv4, this takes into consideration the podman subnet IP family to generate the corresponding default route. Signed-off-by: Antonio Ojea <aojea@redhat.com>
Diffstat (limited to 'pkg/network/ip.go')
-rw-r--r--pkg/network/ip.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/network/ip.go b/pkg/network/ip.go
index 1798cd939..ba93a0d05 100644
--- a/pkg/network/ip.go
+++ b/pkg/network/ip.go
@@ -12,3 +12,8 @@ func CalcGatewayIP(ipn *net.IPNet) net.IP {
nid := ipn.IP.Mask(ipn.Mask)
return ip.NextIP(nid)
}
+
+// IsIPv6 returns if netIP is IPv6.
+func IsIPv6(netIP net.IP) bool {
+ return netIP != nil && netIP.To4() == nil
+}