IPTools icon indicating copy to clipboard operation
IPTools copied to clipboard

count method in Network returns improper value for IPv6

Open hpartidas opened this issue 8 years ago • 1 comments

Hello,

Just recently started working with your classes and realized that the number of hosts for a 64 bit mask in an IPv6 address is being erroneously returned.

Delving into the framework I noticed that you're using bcpow function for IPv6 networks and this keeps returning an unexpected value. In fact after testing with different bit masks, it always caps at 9,223,372,036,854,775,808.

I don't know your reasons for not using the pow function but bcpow is completely breaking IPv6.

hpartidas avatar Nov 28 '16 21:11 hpartidas

Hi, Unfortunately, this error is still not fixed. The solution from the suggested commit works perfectly for me. Can't you accept the fix and tag a new version? That would be awesome! Thanks!

Current version:

dump(Range::parse('1::/0')->count());
9223372036854775807

Suggested fix:

dump(Range::parse('1::/0')->count());
"340282366920938463463374607431768211456"

LinkingYou avatar Nov 29 '22 10:11 LinkingYou