Feature #1275

IPAddr unnecessarily destroys information on creation

Added by Christopher Smith almost 6 years ago. Updated about 3 years ago.

[ruby-core:22855]
Status:Rejected
Priority:Normal
Assignee:Akinori MUSHA

Description

=begin
The IPAddr class internally stores both a complete IP address and a network mask. For many applications, client code needs to be able to track an interface's IP address (say, 10.253.0.20) and its netmask (/24), and in IPv6, both the 128-bit identifier and the netmask are generally considered part of the address.

The current implementation of IPAddr immediately clears all masked bits, making it impossible to store information like "10.253.0.20/24"; instead, the class stores only the network address of 10.253.0.0/24.

Since it is always possible to mask off bits later, IPAddr should internally store the entire address alongside the netmask and provide the masked address on request (as already provided in #mask). I suggest adding an option "mask_host_part=true" to initialize and changing the check condition at 483 to "if prefixlen and mask_host_part" (to keep from breaking current code).
=end


Related issues

Related to Ruby trunk - Feature #1905: How about IPAddr#<=> to take care of mask_addr? Rejected 08/07/2009

History

#1 Updated by Yuki Sonoda over 5 years ago

=begin
Patch is welcome.
=end

#2 Updated by ujihisa . over 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to Akinori MUSHA

=begin

=end

#3 Updated by Kazuhiro NISHIYAMA almost 5 years ago

  • Category changed from core to lib
  • Target version set to 2.0.0

=begin

=end

#4 Updated by Yusuke Endoh about 3 years ago

  • Status changed from Assigned to Rejected

I'm rejecting this feature ticket because no progress has been
made for a long time. See .

I'm not sure if this use case is valid for IPAddr library.
But if you still want the feature seriously, it might be good
to start with creating a patch, as Yugui said.

Yusuke Endoh mame@tsg.ne.jp

Also available in: Atom PDF