[
https://issues.apache.org/jira/browse/CLOUDSTACK-8506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14557252#comment-14557252
]
ASF GitHub Bot commented on CLOUDSTACK-8506:
--------------------------------------------
Github user wilderrodrigues commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/292#discussion_r30943691
--- Diff: utils/src/com/cloud/utils/net/NetUtils.java ---
@@ -329,35 +329,46 @@ public static String getMacAddress(InetAddress
address) {
return sb.toString();
}
- public static long getMacAddressAsLong(InetAddress address) {
+ public static long getMacAddressAsLong(final InetAddress address) {
long macAddressAsLong = 0;
try {
- NetworkInterface ni =
NetworkInterface.getByInetAddress(address);
- byte[] mac = ni.getHardwareAddress();
+ final NetworkInterface ni =
NetworkInterface.getByInetAddress(address);
+ final byte[] mac = ni.getHardwareAddress();
for (int i = 0; i < mac.length; i++) {
- macAddressAsLong |= ((long)(mac[i] & 0xff) << (mac.length
- i - 1) * 8);
+ macAddressAsLong |= (long)(mac[i] & 0xff) << (mac.length -
i - 1) * 8;
}
- } catch (SocketException e) {
+ } catch (final SocketException e) {
s_logger.error("SocketException when trying to retrieve MAC
address", e);
}
return macAddressAsLong;
}
- public static boolean ipRangesOverlap(String startIp1, String endIp1,
String startIp2, String endIp2) {
- long startIp1Long = ip2Long(startIp1);
+ public static boolean ipRangesOverlap(final String startIp1, final
String endIp1, final String startIp2, final String endIp2) {
+ final long startIp1Long = ip2Long(startIp1);
long endIp1Long = startIp1Long;
if (endIp1 != null) {
endIp1Long = ip2Long(endIp1);
}
- long startIp2Long = ip2Long(startIp2);
+ final long startIp2Long = ip2Long(startIp2);
long endIp2Long = startIp2Long;
if (endIp2 != null) {
endIp2Long = ip2Long(endIp2);
}
+ // check if the gatewayip is the part of the ip range being added.
+ // RFC 3021 - 31-Bit Prefixes on IPv4 Point-to-Point Links
+ // GW Netmask Stat IP End IP
+ // 192.168.24.0 - 255.255.255.254 - 192.168.24.0 - 192.168.24.1
+ // https://tools.ietf.org/html/rfc3021
+ // Added by Wilder Rodrigues
+ final int ip31bitPrefixOffSet = 1;
+ if (startIp2Long - startIp1Long == startIp2Long - (endIp1Long -
ip31bitPrefixOffSet)) {
--- End diff --
Nope, it's not. You should check the configurationImpl and see how the
checks are done separately
Or then look at the chat last night. The iPOverlaps method doens't check
cidr, as I said before. It checks that there are only 2 ips in the range
Why that? Because the conditions and all the ConfigurationImpl are doing
the job in many steps
We can discuss it further on Tuesday.
Sent from my iPhone
On 23 May 2015, at 11:09, Daan Hoogland
<[email protected]<mailto:[email protected]>> wrote:
In
utils/src/com/cloud/utils/net/NetUtils.java<https://github.com/apache/cloudstack/pull/292#discussion_r30943403>:
> long endIp2Long = startIp2Long;
> if (endIp2 != null) {
> endIp2Long = ip2Long(endIp2);
> }
>
> + // check if the gatewayip is the part of the ip range being
added.
> + // RFC 3021 - 31-Bit Prefixes on IPv4 Point-to-Point Links
> + // GW Netmask Stat IP End IP
> + // 192.168.24.0 - 255.255.255.254 - 192.168.24.0 - 192.168.24.1
> + // https://tools.ietf.org/html/rfc3021
> + // Added by Wilder Rodrigues
> + final int ip31bitPrefixOffSet = 1;
> + if (startIp2Long - startIp1Long == startIp2Long - (endIp1Long -
ip31bitPrefixOffSet)) {
for any endIp1Long == startIp1Long +1 this condition is true, no matter
what startIp2Long is let alone endIp2Long. So is it the intention to check
(startIp1Long == endIp1Long - ip31bitPrefixOffSet) and return false if it is?
This comes down to a check if this is indeed a /31 range and makes no sense to
me.
—
Reply to this email directly or view it on
GitHub<https://github.com/apache/cloudstack/pull/292/files#r30943403>.
> Make ACS compliant with the RFC 3021
> ------------------------------------
>
> Key: CLOUDSTACK-8506
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8506
> Project: CloudStack
> Issue Type: Improvement
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Wilder Rodrigues
> Assignee: Wilder Rodrigues
>
> On 21 May 2015, at 10:29, Singh, Devender <[email protected]> wrote:
> Hi Cloudstack Team,
> We had no problems building and using /31 networks on 4.2.0, but after our
> upgrade to 4.4.2 we are no longer able to add new ones.
> We have a lot of them already in place. As an example I pasted some output
> from cloudmonkey on a link that is already established and working.
> Does anyone have a workaround, or can point me in the right direction for a
> patch?
> (local) > list networks id=e044c442-48f7-4bae-8c5d-530423a249f7
> count = 1
> network:
> id = e044c442-48f7-4bae-8c5d-530423a249f7
> name = VLAN180
> acltype = Domain
> broadcastdomaintype = Vlan
> broadcasturi = vlan://180
> canusefordeploy = False
> cidr = 202.90.43.0/31
> displaynetwork = True
> displaytext = VM-UTILITY-2
> dns1 = 4.2.2.1
> domain = ROOT
> domainid = 8acf0368-e5b1-11e2-b5cf-2ef4cf18a6ae
> gateway = 202.90.43.0
> ispersistent = False
> issystem = False
> netmask = 255.255.255.254
> networkofferingavailability = Optional
> networkofferingconservemode = False
> networkofferingdisplaytext = private-guest1_switch
> networkofferingid = 0b63d457-5f5e-426f-a81e-8797e522eb8c
> networkofferingname = private-guest1_switch
> physicalnetworkid = cf4c2846-2418-4ba4-b307-6a6405860799
> related = e044c442-48f7-4bae-8c5d-530423a249f7
> restartrequired = False
> service:
> specifyipranges = True
> state = Setup
> strechedl2subnet = False
> subdomainaccess = True
> tags:
> traffictype = Guest
> type = Shared
> vlan = 180
> zoneid = 88066cb4-64ab-4c54-83a9-3279a1e030cb
> zonename = UTILITY-ZONE-1
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)