Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1371#discussion_r62783052
  
    --- Diff: server/src/com/cloud/network/vpc/VpcManagerImpl.java ---
    @@ -809,15 +945,22 @@ public Vpc createVpc(final long zoneId, final long 
vpcOffId, final long vpcOwner
     
         @DB
         protected Vpc createVpc(final Boolean displayVpc, final VpcVO vpc) {
    -        final String cidr = vpc.getCidr();
    -        // Validate CIDR
    -        if (!NetUtils.isValidCIDR(cidr)) {
    -            throw new InvalidParameterValueException("Invalid CIDR 
specified " + cidr);
    -        }
     
    -        // cidr has to be RFC 1918 complient
    -        if (!NetUtils.validateGuestCidr(cidr)) {
    -            throw new InvalidParameterValueException("Guest Cidr " + cidr 
+ " is not RFC1918 compliant");
    +        try {
    +            final CIDR cidr = CIDRFactory.getCIDR(vpc.getCidr());
    +
    +            final CIDR[] superCidr = getZoneSuperCidrList(vpc.zoneId);
    +
    +            if 
(_vpcOffServiceDao.areServicesSupportedByNetworkOffering(vpc.getVpcOfferingId(),
 Service.VPCDynamicRouting)) {
    +                if (!NetUtils.validateGuestCidrForOSPF(cidr, superCidr)) {
    +                    throw new InvalidParameterValueException("Guest Cidr " 
+ cidr + " is not within Zone superCIDR " + Arrays.toString(superCidr));
    +                }
    +            } else if (!NetUtils.validateGuestCidr(cidr)) {
    --- End diff --
    
    Can this validation be moved to the ``CIDR`` interface to support IPv4/IPv6 
dual stack operation?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to