Project

General

Profile

Actions

Feature #1275

closed

IPAddr unnecessarily destroys information on creation

Added by chrylis (Christopher Smith) almost 16 years ago. Updated almost 13 years ago.

Status:
Rejected
Target version:
[ruby-core:22855]

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 1 (0 open1 closed)

Related to Ruby master - Feature #1905: How about IPAddr#<=> to take care of mask_addr?Rejectedknu (Akinori MUSHA)08/07/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0