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>
This commit is contained in:
Paul Holzinger 2021-08-26 18:41:19 +02:00
parent 24bec9a76b
commit 218f132fdf
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
2 changed files with 11 additions and 0 deletions

View File

@ -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)
}
}

View File

@ -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() {