Skip to content

Commit b376035

Browse files
author
Alena Prokharchyk
committed
VPC: CS-15805 - guest cidr should be RFC1918 complient
1 parent f0baaf6 commit b376035

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎server/src/com/cloud/network/vpc/VpcManagerImpl.java‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,11 @@ protected Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpc
583583
if (!NetUtils.isValidCIDR(cidr)) {
584584
throw new InvalidParameterValueException("Invalid CIDR specified " + cidr);
585585
}
586+
587+
//cidr has to be RFC 1918 complient
588+
if (!NetUtils.validateGuestCidr(cidr)) {
589+
throw new InvalidParameterValueException("Guest Cidr " + cidr + " is not RFC1918 compliant");
590+
}
586591

587592
// validate network domain
588593
if (!NetUtils.verifyDomainName(networkDomain)) {
@@ -593,16 +598,6 @@ protected Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpc
593598
+ "and the hyphen ('-'); can't start or end with \"-\"");
594599
}
595600

596-
597-
// //don't allow overlapping CIDRS for the VPCs of the same account
598-
// List<? extends Vpc> vpcs = getVpcsForAccount(vpcOwner.getId());
599-
// for (Vpc vpc : vpcs) {
600-
// if (NetUtils.isNetworksOverlap(cidr, vpc.getCidr())) {
601-
// throw new InvalidParameterValueException("Account already has vpc with cidr " + vpc.getCidr() +
602-
// " that overlaps the cidr specified: " + cidr, null);
603-
// }
604-
// }
605-
606601
Transaction txn = Transaction.currentTxn();
607602
txn.start();
608603
VpcVO vpc = new VpcVO (zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr,

0 commit comments

Comments
 (0)