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

Comparing an IPv4-address with IPv6-address failed #56

Closed
ghost opened this issue Jan 23, 2015 · 5 comments
Closed

Comparing an IPv4-address with IPv6-address failed #56

ghost opened this issue Jan 23, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 23, 2015

Hi there,
I'm tried the gem and the latest version of IPAddress from the git repository. In both cases I got an error when comparing an IPv4-address with an IPv6-address. Can you help me with suggestions to work around the problem?

[1] pry(#<ApplProxyMgt::ForwardingEntry>)> IPAddress.parse('127.0.0.1').include? IPAddress.parse('::1')
NoMethodError: undefined method `to_u32' for #<IPAddress::IPv6:0x00000005e46a38>
from /home/user/.gem/ruby/2.2.0/bundler/gems/ipaddress-ce5b52474875/lib/ipaddress/ipv4.rb:537:in `include?'
@msimkins
Copy link

IPV4 Addresses and IPV6 Addresses are not compatible, so that comparison should not work

@ghost
Copy link
Author

ghost commented Feb 13, 2015

Ok. Maybe it would be better to add a test for that and raise a proper exception?

@ghost
Copy link
Author

ghost commented Feb 13, 2015

What about mapped IP4-addresses?

@alxnet
Copy link

alxnet commented Apr 11, 2015

+1 to fix, imho it would be more intuitive to return false instead of an exception:

(IPAddress 'fd80::/64').include?(IPAddress '10.0.0.1/24')
=> false
(IPAddress '10.0.0.1/24').include?(IPAddress 'fd80::/64')
=> NoMethodError: undefined method `to_u32' for ..

P.S.: ipaddress (0.8.0)

@sandstrom
Copy link
Collaborator

I'm doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it's quite old and haven't gotten much attention, I'll close it down.

Feel free to open up a discussion under the 'Discussions' tab if you think this is a missing feature, and would like to gauge other peoples interest in the functionality.

By closing some old issues we reduce the list of open issues to a more manageable set. I hope you understand!

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

No branches or pull requests

3 participants