[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can we kill net-tools, please?



Russ Allbery <rra@debian.org> writes:
> Christian Seiler <christian@iwakd.de> writes:
>> On 12/29/2016 08:38 PM, Russ Allbery wrote:
>
>>> ip address also has one of the worst output UI decisions I've ever seen,
>>> namely this line:
>>> 
>>>     inet 192.168.0.195/24 brd 192.168.0.255 scope global dynamic wlan0
>>> 
>>> specifically "192.168.0.195/24", which is notation (IIRC) invented by this
>>> command,
>
>> Nope, that's RFC 4632, Section 3.1, where that was introduced
>> first, see
>> https://tools.ietf.org/html/rfc4632#section-3.1
>
> No, I'm not talking about CIDR notation, which of course is long-standing
> and familiar.  I'm talking about randomly appending a CIDR suffix to
> something that is obviously *not* the base for that CIDR block.
>
> In other words, 192.168.0.0/24 is fine.  The problem is with deciding to
> merge two completely different things (a CIDR network specification, and
> an individual IP address) in this weird hybrid notation that, by RFC 4632,
> would mean the network starting at 192.168.0.195 and extending for a /24.
> Which is a nonsensical specification.

I believe that is a mis-interpretation of that RFC.  The examples are
all network addresses, but I don't think there is anything there that
restricts the CIDR notation only to that class of IPv4 addresses.

FWIW, the notation is much older and has been used for IPv4 address +
mask long before that RFC or the introduction of the "ip" tool.  I am
unable to find the original first use, but here's at least one older
reference (from 1998):
https://tools.ietf.org/html/rfc2373#section-2.3

  "The text representation of IPv6 address prefixes is similar to the
   way IPv4 addresses prefixes are written in CIDR notation.  An IPv6
   address prefix is represented by the notation:

      ipv6-address/prefix-length
  "


The IPv4 CIDR notation was obviously already well enough known to be
used to explain the new IPv6 notation. I believe the above paragraph
would be very confusing, to the point of not making sense at all, if the
IPv4 notation was known to be used only for network address +
prefix-length.


> IIRC, this was done in ip to "save space" instead of using the natural
> expression, namely:
>
>     192.168.0.195 net 192.168.0.0/24


"save space" by removing redundant information was pretty much the only
reason to introduce the prefix-length, wasn't it?  Well, maybe not... It
also prevents anyone from trying to configure a netmask with holes in
it.

But if you always had to include the redundant network address, then you
wouldn't save any space.  What would the point of the CIDR notation be
then?  You might as well use one of the mask notations:
 
 192.168.0.195 0.0.0.255
 192.168.0.195 255.255.255.0

They are just as short (and commonly used, just like 192.168.0.195/24 is)

> Saving space in UI output intended for humans by introducing new notation
> is almost never a good idea.

True.  But in this case it makes the result easier to read by removing
duplicate information.  That is good.


Bjørn


Reply to: