mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
move back to original contract of isNetworksOverlap()
This commit is contained in:
parent
b4c5cd4e22
commit
4b7f87b9c8
@ -1170,14 +1170,15 @@ public class NetUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNetworksOverlap(final String cidrA, final String cidrB) {
|
public static boolean isNetworksOverlap(final String cidrA, final String cidrB) {
|
||||||
if (!areCidrsNotEmpty(cidrA, cidrB)) {
|
try {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Long[] cidrALong = cidrToLong(cidrA);
|
Long[] cidrALong = cidrToLong(cidrA);
|
||||||
Long[] cidrBLong = cidrToLong(cidrB);
|
Long[] cidrBLong = cidrToLong(cidrB);
|
||||||
|
|
||||||
final long shift = MAX_CIDR - (cidrALong[1] > cidrBLong[1] ? cidrBLong[1] : cidrALong[1]);
|
final long shift = MAX_CIDR - (cidrALong[1] > cidrBLong[1] ? cidrBLong[1] : cidrALong[1]);
|
||||||
return cidrALong[0] >> shift == cidrBLong[0] >> shift;
|
return cidrALong[0] >> shift == cidrBLong[0] >> shift;
|
||||||
|
} catch (CloudRuntimeException e) {
|
||||||
|
s_logger.error(e.getLocalizedMessage(),e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidS2SVpnPolicy(final String policys) {
|
public static boolean isValidS2SVpnPolicy(final String policys) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user