Github user DaanHoogland commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1057#discussion_r44515725
--- Diff: utils/src/main/java/com/cloud/utils/net/NetUtils.java ---
@@ -775,11 +776,19 @@ public static String getSubNet(final String ip, final
String netmask) {
}
public static String getCidrSubNet(final String ip, final long
cidrSize) {
- final long numericNetmask = 0xffffffff >> MAX_CIDR - cidrSize <<
MAX_CIDR - cidrSize;
+ final long numericNetmask = netMaskFromCidr(cidrSize);
final String netmask = NetUtils.long2Ip(numericNetmask);
return getSubNet(ip, netmask);
}
+ /**
+ * @param cidrSize
+ * @return
+ */
+ static long netMaskFromCidr(final long cidrSize) {
+ return ((long)0xffffffff) >> MAX_CIDR - cidrSize << MAX_CIDR -
cidrSize;
+ }
+
--- End diff --
for testing purpose
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---