janvanbesien / java-ipv6

Java library to represent IPv6 addresses, networks, and related concepts
Apache License 2.0
85 stars 33 forks source link

IPv6Network iterator returns wrong addresses #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a IPv6Network from String, 
e.g."ffff:ffff:ffff:ffff:ffff:ffff:ffff:0000/126"
2. Get the iterator from the IPv6Network.
3. Iterate over the iterator

What is the expected output? What do you see instead?
From the network address ffff:ffff:ffff:ffff:ffff:ffff:ffff:0000 with netmask 
/126, valid addresses are;
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0000
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0001
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0002
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0003

But the iterator gives me  

ffff:ffff:ffff:ffff:ffff:ffff:ffff:0001
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0002
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0003
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0004

If I use the ipv6Network.getFirst().toLongString() I get
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0000
And if I use ipv6Network.getLast().toLongString() I get
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0003

What version of the product are you using? On what operating system?
Version 0.12 on windows 7.

Please provide any additional information below.
I have attached a simple JUnit test case that proves this.
I have also verified the correctness of my assumptions by testing the data with 
a public IPv6 calculator such as
http://www.coris.org.uk/cgi-bin/ip6addr

Original issue reported on code.google.com by mikael.b...@gmail.com on 22 May 2013 at 11:14

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reporting. That sounds like a bug indeed. I'll look into it.

Original comment by janvanbesien@gmail.com on 22 May 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Fixed in SVN trunk. There was a stupid mistake in the iterator. I added a unit 
test based on yours.

Original comment by janvanbesien@gmail.com on 22 May 2013 at 11:44

GoogleCodeExporter commented 9 years ago
Great, thanks for quick response!

Original comment by mikael.b...@gmail.com on 22 May 2013 at 11:46

GoogleCodeExporter commented 9 years ago
released 0.13. 

Original comment by janvanbesien@gmail.com on 24 May 2013 at 2:41