@@ -1147,22 +1147,26 @@ public static boolean validateGuestCidr(final String cidr) {
11471147 // 10.0.0.0 - 10.255.255.255 (10/8 prefix)
11481148 // 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
11491149 // 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
1150-
1151- final String cidr1 = "10.0.0.0/8" ;
1152- final String cidr2 = "172.16.0.0/12" ;
1153- final String cidr3 = "192.168.0.0/16" ;
1150+ // RFC 6598 - The IETF detailed shared address space for use in ISP CGN
1151+ // deployments and NAT devices that can handle the same addresses occurring both on inbound and outbound interfaces.
1152+ // ARIN returned space to the IANA as needed for this allocation.
1153+ // The allocated address block is 100.64.0.0/10
1154+ final String [] allowedNetBlocks = {"10.0.0.0/8" , "172.16.0.0/12" , "192.168.0.0/16" , "100.64.0.0/10" };
11541155
11551156 if (!isValidCIDR (cidr )) {
11561157 s_logger .warn ("Cidr " + cidr + " is not valid" );
11571158 return false ;
11581159 }
11591160
1160- if (isNetworkAWithinNetworkB (cidr , cidr1 ) || isNetworkAWithinNetworkB (cidr , cidr2 ) || isNetworkAWithinNetworkB (cidr , cidr3 )) {
1161- return true ;
1162- } else {
1163- s_logger .warn ("cidr " + cidr + " is not RFC 1918 compliant" );
1164- return false ;
1161+ for (String block : allowedNetBlocks ) {
1162+ if (isNetworkAWithinNetworkB (cidr , block )) {
1163+ return true ;
1164+ }
11651165 }
1166+
1167+ // not in allowedNetBlocks - return false
1168+ s_logger .warn ("cidr " + cidr + " is not RFC 1918 or 6598 compliant" );
1169+ return false ;
11661170 }
11671171
11681172 public static boolean verifyInstanceName (final String instanceName ) {
@@ -1171,7 +1175,6 @@ public static boolean verifyInstanceName(final String instanceName) {
11711175 s_logger .warn ("Instance name can not contain hyphen, spaces and \" +\" char" );
11721176 return false ;
11731177 }
1174-
11751178 return true ;
11761179 }
11771180
0 commit comments