weizhouapache commented on code in PR #10174:
URL: https://github.com/apache/cloudstack/pull/10174#discussion_r1913701860
##########
services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
##########
@@ -402,10 +402,13 @@ private List<String> getAllowedInternalSiteCidrs() {
}
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));
+ } else if (NetUtils.isValidIp4(cidr)) {
Review Comment:
@DaanHoogland
I added a test below
```
System.out.println(NetUtils.isValidIp4Cidr("0.0.0.0/32"));
System.out.println(NetUtils.isValidIp4Cidr("0.0.0.0/0"));
System.out.println(NetUtils.isValidIp4Cidr("0.0.0.0"));
System.out.println(NetUtils.isValidIp4("0.0.0.0"));
```
and got the result
```
true
true
false
true
```
the global setting descriptions says 0.0.0.0 is not valid. it looks like we
need to exclude 0.0.0.0 in line 410, agree ?
Question, is `0.0.0.0/0` or `0.0.0.0/32` valid ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]