Skip to content

Commit 5874e80

Browse files
authored
Apply suggestions from code review
1 parent 6a18b66 commit 5874e80

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ private List<String> getAllowedInternalSiteCidrs() {
402402
}
403403
String[] cidrs = _allowedInternalSites.split(",");
404404
for (String cidr : cidrs) {
405-
if (NetUtils.isValidIp4Cidr(cidr)) {
405+
if (NetUtils.isValidIp4Cidr(cidr) && !cidr.startsWith("0.0.0.0")) {
406406
if (! NetUtils.getCleanIp4Cidr(cidr).equals(cidr)) {
407407
s_logger.warn(String.format("Invalid CIDR %s in %s", cidr, SecStorageAllowedInternalDownloadSites.key()));
408408
}
@@ -411,8 +411,6 @@ private List<String> getAllowedInternalSiteCidrs() {
411411
String newCidr = cidr + "/32";
412412
s_logger.warn(String.format("Ip address is not a valid CIDR; %s using %s/32", cidr, newCidr));
413413
allowedCidrs.add(newCidr);
414-
} else if (!cidr.startsWith("0.0.0.0")) {
415-
allowedCidrs.add(NetUtils.getCleanIp4Cidr(cidr));
416414
}
417415
}
418416
return allowedCidrs;

utils/src/main/java/com/cloud/utils/net/NetUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public static boolean isValidIp4Cidr(final String cidr) {
574574

575575
final String[] cidrPair = cidr.split("\\/");
576576
if (cidrPair.length != 2) {
577-
return isValidIp4(cidr); // we consider an ip4v address as a valid /32 cidr
577+
return false;
578578
}
579579
final String cidrAddress = cidrPair[0];
580580
final String cidrSize = cidrPair[1];

0 commit comments

Comments
 (0)