diff options
author | Jeremy Evans <[email protected]> | 2021-10-07 08:02:46 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2021-10-11 13:50:54 +0900 |
commit | 391d6ab4f7c3070d0c46dbd7496255d8269f6c1f () | |
tree | 5a438b590f11fb6a148e338c724bcdec4977b057 /lib/ipaddr.rb | |
parent | 9a321dd9b2fb929873a6b50b41efdf3bd3119536 (diff) |
[ruby/ipaddr] Fix include? and ipv4_mapped to allow drb tests to pass
include? should return false if comparing an IPv4 address to an IPv6 address. ipv4_mapped needs to set the correct netmask on the mapped addresses. https://.com/ruby/ipaddr/commit/da22ef8e6c
-rw-r--r-- | lib/ipaddr.rb | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -173,8 +173,10 @@ class IPAddr # p net1.include?(net4) #=> false # p net4.include?(net1) #=> true def include?(other) range = to_range - other = coerce_other(other).to_range range.begin <= other.begin && range.end >= other.end end alias === include? @@ -316,7 +318,9 @@ class IPAddr if !ipv4? raise InvalidAddressError, "not an IPv4 address: #{@addr}" end - return self.clone.set(@addr | 0xffff00000000, Socket::AF_INET6) end # Returns a new ipaddr built by converting the native IPv4 address |