Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider a valid ipv4 address as a validish ipv4 /32 cidr #10174

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,13 @@
}
String[] cidrs = _allowedInternalSites.split(",");
for (String cidr : cidrs) {
if (NetUtils.isValidIp4Cidr(cidr) || NetUtils.isValidIp4(cidr) || !cidr.startsWith("0.0.0.0")) {
if (NetUtils.getCleanIp4Cidr(cidr).equals(cidr)) {
if (NetUtils.isValidIp4Cidr(cidr) && !cidr.startsWith("0.0.0.0")) {
if (! NetUtils.getCleanIp4Cidr(cidr).equals(cidr)) {
s_logger.warn(String.format("Invalid CIDR %s in %s", cidr, SecStorageAllowedInternalDownloadSites.key()));
}
allowedCidrs.add(NetUtils.getCleanIp4Cidr(cidr));

Check warning on line 409 in services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L409 was not covered by tests
} else if (NetUtils.isValidIp4(cidr) && !cidr.startsWith("0.0.0.0")) {
s_logger.warn(String.format("Ip address is not a valid CIDR; %s consider using %s/32", cidr, cidr));

Check warning on line 411 in services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L411 was not covered by tests
allowedCidrs.add(cidr);
}
}
Expand Down
Loading