-
Notifications
You must be signed in to change notification settings - Fork 63
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
Exception thrown if trying to join all IPv4 and all IPv6 addresses #86
Comments
Yes, this is a bug. Thanks for providing the test case. The issue will happen when joining both IPv4 and IPv6 ranges, and one of the IPv4 ranges includes the address 255.255.255.255. I will have this fixed in a maintenance release soon. In the meantime, you could use the following work-around which is almost as efficient as the original:
|
Thanks for prompt response. |
Hey @seancfoley, any news on this? |
@dbardbar I have not yet released the next maintenance release, but it is certainly time to do so, so I should get to it within a month. |
Took a bit longer than a month. This was fixed in version 5.4.0. Closing. |
I'm ipaddress version 5.3.4 on Java 8.
My use-case is that I have multiple ranges of IPs, both IPv4 and IPv6 (possibly with various overlaps), and I want to compact them all, and later do a binary search on the sorted array given by IPAddressSeqRange.join() to quickly check if a given IP (v4 or v6) is in any of those ranges.
join() seems to work fine with a mix of IPv4 and IPv6, but I encountered one annoying edge case where the ranges span all possible v4 and v6 addresses.
I have not encountered problems when trying to join full IPv4 range with additional ranges. As far as I can see this is the only problematic edge case.
I get an exception of
1, IP Address error: exceeds address size
inet.ipaddr.AddressValueException: 1, IP Address error: exceeds address size
at inet.ipaddr.format.standard.AddressDivisionGrouping.checkOverflow(AddressDivisionGrouping.java:1204)
at inet.ipaddr.ipv4.IPv4AddressSection.increment(IPv4AddressSection.java:1209)
at inet.ipaddr.ipv4.IPv4Address.increment(IPv4Address.java:717)
at inet.ipaddr.ipv4.IPv4Address.increment(IPv4Address.java:70)
at inet.ipaddr.IPAddressSeqRange.join(IPAddressSeqRange.java:668)
Provided is a test case that causes the exception
The text was updated successfully, but these errors were encountered: