@@ -1141,22 +1141,26 @@ public static boolean validateGuestCidr(final String cidr) {
11411141 // 10.0.0.0 - 10.255.255.255 (10/8 prefix)
11421142 // 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
11431143 // 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
1144-
1145- final String cidr1 = "10.0.0.0/8" ;
1146- final String cidr2 = "172.16.0.0/12" ;
1147- final String cidr3 = "192.168.0.0/16" ;
1144+ // RFC 6598 - The IETF detailed shared address space for use in ISP CGN
1145+ // deployments and NAT devices that can handle the same addresses occurring both on inbound and outbound interfaces.
1146+ // ARIN returned space to the IANA as needed for this allocation.
1147+ // The allocated address block is 100.64.0.0/10
1148+ final String [] allowedNetBlocks = {"10.0.0.0/8" , "172.16.0.0/12" , "192.168.0.0/16" , "100.64.0.0/10" };
11481149
11491150 if (!isValidCIDR (cidr )) {
11501151 s_logger .warn ("Cidr " + cidr + " is not valid" );
11511152 return false ;
11521153 }
11531154
1154- if (isNetworkAWithinNetworkB (cidr , cidr1 ) || isNetworkAWithinNetworkB (cidr , cidr2 ) || isNetworkAWithinNetworkB (cidr , cidr3 )) {
1155- return true ;
1156- } else {
1157- s_logger .warn ("cidr " + cidr + " is not RFC 1918 compliant" );
1158- return false ;
1155+ for (String block : allowedNetBlocks ) {
1156+ if (isNetworkAWithinNetworkB (cidr , block )) {
1157+ return true ;
1158+ }
11591159 }
1160+
1161+ // not in allowedNetBlocks - return false
1162+ s_logger .warn ("cidr " + cidr + " is not RFC 1918 or 6598 compliant" );
1163+ return false ;
11601164 }
11611165
11621166 public static boolean verifyInstanceName (final String instanceName ) {
@@ -1165,7 +1169,6 @@ public static boolean verifyInstanceName(final String instanceName) {
11651169 s_logger .warn ("Instance name can not contain hyphen, spaces and \" +\" char" );
11661170 return false ;
11671171 }
1168-
11691172 return true ;
11701173 }
11711174
0 commit comments