libnetwork: ipvlan: processIPAM(): simplify
Remove redundant checks and intermediate variables. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8d067bbdb4
commit
35cba9b1c9
1 changed files with 10 additions and 16 deletions
|
@ -256,22 +256,16 @@ func (config *configuration) fromOptions(labels map[string]string) error {
|
|||
|
||||
// processIPAM parses v4 and v6 IP information and binds it to the network configuration
|
||||
func (config *configuration) processIPAM(ipamV4Data, ipamV6Data []driverapi.IPAMData) {
|
||||
if len(ipamV4Data) > 0 {
|
||||
for _, ipd := range ipamV4Data {
|
||||
s := &ipSubnet{
|
||||
SubnetIP: ipd.Pool.String(),
|
||||
GwIP: ipd.Gateway.String(),
|
||||
}
|
||||
config.Ipv4Subnets = append(config.Ipv4Subnets, s)
|
||||
}
|
||||
for _, ipd := range ipamV4Data {
|
||||
config.Ipv4Subnets = append(config.Ipv4Subnets, &ipSubnet{
|
||||
SubnetIP: ipd.Pool.String(),
|
||||
GwIP: ipd.Gateway.String(),
|
||||
})
|
||||
}
|
||||
if len(ipamV6Data) > 0 {
|
||||
for _, ipd := range ipamV6Data {
|
||||
s := &ipSubnet{
|
||||
SubnetIP: ipd.Pool.String(),
|
||||
GwIP: ipd.Gateway.String(),
|
||||
}
|
||||
config.Ipv6Subnets = append(config.Ipv6Subnets, s)
|
||||
}
|
||||
for _, ipd := range ipamV6Data {
|
||||
config.Ipv6Subnets = append(config.Ipv6Subnets, &ipSubnet{
|
||||
SubnetIP: ipd.Pool.String(),
|
||||
GwIP: ipd.Gateway.String(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue