Parse CIDR strings without separating into subnet and address
This commit is contained in:
1 parent
73f1a04d5f
commit
604309fb53
3 files changed
+15
-7
No files matched your search
+4
-1
@@ -340,9 +340,12 @@ func createOverlay(datapathName string, ifaceName string, host string, port int,
|
||||
}
|
||||
|
||||
func parseAndCheckCIDR(cidrStr string) address.CIDR {
|
||||
_, cidr, err := address.ParseCIDR(cidrStr)
|
||||
cidr, err := address.ParseCIDR(cidrStr)
|
||||
checkFatal(err)
|
||||
|
||||
if !cidr.IsSubnet() {
|
||||
Log.Fatalf("Invalid allocation range %s - bits after network prefix are not all zero", cidrStr)
|
||||
}
|
||||
if cidr.Size() < ipam.MinSubnetSize {
|
||||
Log.Fatalf("Allocation range smaller than minimum size %d: %s", ipam.MinSubnetSize, cidrStr)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user