summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-08-26 18:41:19 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-15 18:05:27 +0200
commit218f132fdf4939d9e0374ef860d534f19e71df54 (patch)
tree4dfb6069c94d14aaca139a4c919c2bb96d74fe01
parent24bec9a76bcc2d8e93670047ed0ee8c16d9d7620 (diff)
downloadpodman-218f132fdf4939d9e0374ef860d534f19e71df54.tar.gz
podman-218f132fdf4939d9e0374ef860d534f19e71df54.tar.bz2
podman-218f132fdf4939d9e0374ef860d534f19e71df54.zip
cni network configs set ipv6 enables correctly
When configs are loaded from disk we need to check if they contain a ipv6 subnet and set ipv6 enables to true in this case. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r--libpod/network/cni/cni_conversion.go3
-rw-r--r--libpod/network/cni/config_test.go8
2 files changed, 11 insertions, 0 deletions
diff --git a/libpod/network/cni/cni_conversion.go b/libpod/network/cni/cni_conversion.go
index 09943948b..060794ebe 100644
--- a/libpod/network/cni/cni_conversion.go
+++ b/libpod/network/cni/cni_conversion.go
@@ -185,6 +185,9 @@ func convertIPAMConfToNetwork(network *types.Network, ipam ipamConfig, confPath
s.LeaseRange.StartIP = rangeStart
s.LeaseRange.EndIP = rangeEnd
}
+ if util.IsIPv6(s.Subnet.IP) {
+ network.IPv6Enabled = true
+ }
network.Subnets = append(network.Subnets, s)
}
}
diff --git a/libpod/network/cni/config_test.go b/libpod/network/cni/config_test.go
index 2465f1d1c..11ad71870 100644
--- a/libpod/network/cni/config_test.go
+++ b/libpod/network/cni/config_test.go
@@ -313,6 +313,14 @@ var _ = Describe("Config", func() {
Expect(network1.Subnets[0].Subnet.String()).To(Equal(subnet))
Expect(network1.Subnets[0].Gateway.String()).To(Equal("fdcc::1"))
Expect(network1.Subnets[0].LeaseRange).To(BeNil())
+
+ // reload configs from disk
+ libpodNet, err = getNetworkInterface(cniConfDir, false)
+ Expect(err).To(BeNil())
+ // check the the networks are identical
+ network2, err := libpodNet.NetworkInspect(network1.Name)
+ Expect(err).To(BeNil())
+ Expect(network1).To(Equal(network2))
})
It("create bridge with ipv6 enabled", func() {