diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-10 13:50:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 13:50:43 +0000 |
commit | 20b26b521079234319b362c5a840e30d85f4f9b3 (patch) | |
tree | 629cd28989968869dad0f48dec0b848987aba39e /libpod/network/netconflist.go | |
parent | da95fb4226c82694af19610578d9c14a6aa964f2 (diff) | |
parent | aabf28a16825aec643206d5e3084940ea48b9c99 (diff) | |
download | podman-20b26b521079234319b362c5a840e30d85f4f9b3.tar.gz podman-20b26b521079234319b362c5a840e30d85f4f9b3.tar.bz2 podman-20b26b521079234319b362c5a840e30d85f4f9b3.zip |
Merge pull request #8143 from aojea/dual
enable ipv6 networks
Diffstat (limited to 'libpod/network/netconflist.go')
-rw-r--r-- | libpod/network/netconflist.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libpod/network/netconflist.go b/libpod/network/netconflist.go index 8187fdb39..b95980529 100644 --- a/libpod/network/netconflist.go +++ b/libpod/network/netconflist.go @@ -42,8 +42,7 @@ func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, ipamCo } // NewIPAMHostLocalConf creates a new IPAMHostLocal configfuration -func NewIPAMHostLocalConf(subnet *net.IPNet, routes []IPAMRoute, ipRange net.IPNet, gw net.IP) (IPAMHostLocalConf, error) { - var ipamRanges [][]IPAMLocalHostRangeConf +func NewIPAMHostLocalConf(routes []IPAMRoute, ipamRanges [][]IPAMLocalHostRangeConf) (IPAMHostLocalConf, error) { ipamConf := IPAMHostLocalConf{ PluginType: "host-local", Routes: routes, @@ -51,22 +50,19 @@ func NewIPAMHostLocalConf(subnet *net.IPNet, routes []IPAMRoute, ipRange net.IPN //ResolveConf: "", //DataDir: "" } - IPAMRange, err := newIPAMLocalHostRange(subnet, &ipRange, &gw) - if err != nil { - return ipamConf, err - } - ipamRanges = append(ipamRanges, IPAMRange) + ipamConf.Ranges = ipamRanges return ipamConf, nil } -func newIPAMLocalHostRange(subnet *net.IPNet, ipRange *net.IPNet, gw *net.IP) ([]IPAMLocalHostRangeConf, error) { //nolint:interfacer +// NewIPAMLocalHostRange create a new IPAM range +func NewIPAMLocalHostRange(subnet *net.IPNet, ipRange *net.IPNet, gw net.IP) ([]IPAMLocalHostRangeConf, error) { //nolint:interfacer var ranges []IPAMLocalHostRangeConf hostRange := IPAMLocalHostRangeConf{ Subnet: subnet.String(), } // an user provided a range, we add it here - if ipRange.IP != nil { + if ipRange != nil && ipRange.IP != nil { first, err := FirstIPInSubnet(ipRange) if err != nil { return nil, err |