You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if it is intended behaviour, but IPAddr.new('10.0.0.0/16') == IPAddr.new('10.0.0.0/8') is true, when these are not the same network. The test should be
def ==(value) @addr == value.addr && @mask_addr == value.mask_addr
end
Which also means adding
attr_reader :addr
attr_reader :mask_addr
The text was updated successfully, but these errors were encountered:
I can see a case for the current code being right, in that they are the same ping-able IP address.
The problem is that IPAddr is trying to be both a representation of a network, and of a single IP address. It might be better to have an IPNet class that inherits from the IPAddr class, and check the masks in the IPNet case, and not the IPAddr case.
include? would be an interesting case, in that it could be checking that the IPAddr is in an IPNet, or it could check that an IPNet is a subnet of another IPNet (the argument's mask <= instance's mask)
Not sure if it is intended behaviour, but IPAddr.new('10.0.0.0/16') == IPAddr.new('10.0.0.0/8') is true, when these are not the same network. The test should be
def ==(value)
@addr == value.addr && @mask_addr == value.mask_addr
end
Which also means adding
attr_reader :addr
attr_reader :mask_addr
The text was updated successfully, but these errors were encountered: