1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Reject a null v4 IPAM slice in exp vlan drivers

Issue #1018

Signed-off-by: Brent Salisbury <brent@docker.com>
This commit is contained in:
Brent Salisbury 2016-03-13 00:42:00 -05:00
parent 176c9804f3
commit 2b2d011899
2 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,10 @@ func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Da
return fmt.Errorf("kernel version failed to meet the minimum ipvlan kernel requirement of %d.%d, found %d.%d.%d",
ipvlanKernelVer, ipvlanMajorVer, kv.Kernel, kv.Major, kv.Minor)
}
// reject a null v4 network
if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" {
return fmt.Errorf("ipv4 pool is empty")
}
// parse and validate the config and bind to networkConfiguration
config, err := parseNetworkOptions(nid, option)
if err != nil {

View file

@ -25,6 +25,10 @@ func (d *driver) CreateNetwork(nid string, option map[string]interface{}, ipV4Da
return fmt.Errorf("kernel version failed to meet the minimum macvlan kernel requirement of %d.%d, found %d.%d.%d",
macvlanKernelVer, macvlanMajorVer, kv.Kernel, kv.Major, kv.Minor)
}
// reject a null v4 network
if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" {
return fmt.Errorf("ipv4 pool is empty")
}
// parse and validate the config and bind to networkConfiguration
config, err := parseNetworkOptions(nid, option)
if err != nil {