Skip to content
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

using split() fails if you request more than 32 networks #40

Closed
neoice opened this issue May 30, 2014 · 2 comments · Fixed by #61
Closed

using split() fails if you request more than 32 networks #40

neoice opened this issue May 30, 2014 · 2 comments · Fixed by #61
Assignees

Comments

@neoice
Copy link

neoice commented May 30, 2014

a Class B network, like "10.13.0.0/16" contains 256 Class C networks [1]. consider the example code:

require 'ipaddress'
x = IPAddress('10.13.0.0/16')
c_class_count = (x.hosts.length / 256) + 1
x.split(c_class_count)

this results in the following error:

ArgumentError: New prefix must be between 16 and 32
from PATH/vendor/cache/ruby/1.9.1/gems/ipaddress-0.8.0/lib/ipaddress/ipv4.rb:684:in `subnet'

I also used "10.0.0.0/8" and reproduced the same behavior.

[1] http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks

@bluemonk
Copy link
Collaborator

bluemonk commented Jun 1, 2014

Thanks for filing up this bug. Looks quite strange. I'll dig into it.

mikemackintosh added a commit to mikemackintosh/ipaddress that referenced this issue Mar 23, 2015
mikemackintosh added a commit to mikemackintosh/ipaddress that referenced this issue Mar 23, 2015
@mikemackintosh mikemackintosh self-assigned this Mar 24, 2015
@mikemackintosh
Copy link
Collaborator

This has been included here - #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants