mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
libnetwork/cnmallocator: fix append to non-zero initialized length (makezero)
libnetwork/cnmallocator/networkallocator.go:876:17: append to slice `ipamConfigs` with non-zero initialized length (makezero)
ipamConfigs = append(ipamConfigs, &api.IPAMConfig{Family: api.IPAMConfig_IPV4})
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -865,7 +865,7 @@ func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[string]string,
|
||||
// configs over Spec configs.
|
||||
if n.IPAM != nil {
|
||||
ipamConfigs = n.IPAM.Configs
|
||||
} else if n.Spec.IPAM != nil {
|
||||
} else if n.Spec.IPAM != nil && len(n.Spec.IPAM.Configs) > 0 {
|
||||
ipamConfigs = make([]*api.IPAMConfig, len(n.Spec.IPAM.Configs))
|
||||
copy(ipamConfigs, n.Spec.IPAM.Configs)
|
||||
}
|
||||
@@ -873,7 +873,7 @@ func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[string]string,
|
||||
// Append an empty slot for subnet allocation if there are no
|
||||
// IPAM configs from either spec or state.
|
||||
if len(ipamConfigs) == 0 {
|
||||
ipamConfigs = append(ipamConfigs, &api.IPAMConfig{Family: api.IPAMConfig_IPV4})
|
||||
ipamConfigs = []*api.IPAMConfig{{Family: api.IPAMConfig_IPV4}}
|
||||
}
|
||||
|
||||
// Update the runtime IPAM configurations with initial state
|
||||
|
||||
Reference in New Issue
Block a user