Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1371#discussion_r62779835 --- Diff: engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java --- @@ -2024,8 +2047,25 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam // Check if cidr is RFC1918 compliant if the network is Guest Isolated for IPv4 if (cidr != null && ntwkOff.getGuestType() == Network.GuestType.Isolated && ntwkOff.getTrafficType() == TrafficType.Guest) { - if (!NetUtils.validateGuestCidr(cidr)) { - throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC1918 compliant"); + //check if the vpc supports dynamic routing, this network may not participate in dynamic routing but still the cidr has to be ospf compliant + final Vpc vpc = _vpcMgr.getActiveVpc(vpcId); + if (_vpcOffServiceDao.areServicesSupportedByNetworkOffering(vpc.getVpcOfferingId(), Service.VPCDynamicRouting)) { + _dcDao.loadDetails(zone); + try { + final CIDR[] superCidr = _vpcMgr.getZoneSuperCidrList(zoneId); + final CIDR ncidr = CIDRFactory.getCIDR(cidr); + if (!NetUtils.validateGuestCidrForOSPF(ncidr, superCidr)) { + throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not compliant for this dynamically routed network."); + } + } + catch (BadCIDRException ex){ + throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not compliant for this dynamically routed network."); + } + } + else { + if (!NetUtils.validateGuestCidr(cidr)) { + throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC1918 compliant"); + } --- End diff -- Why not wrap this validation logic in a static method on the ``CIDR`` interface?
--- 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. ---