[Bug 258874] route add -inet 240/4 results in 0.0.0.0/4 127.0.0.1 UGRS lo0

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 07 Jan 2024 17:52:40 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258874

paul vixie <paul@redbarn.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paul@redbarn.org

--- Comment #10 from paul vixie <paul@redbarn.org> ---
in inet_addr(3) we see this text:

   INTERNET ADDRESSES
     Values specified using the ‘.’ notation take one of the following forms:

           a.b.c.d
           a.b.c
           a.b
           a

     When four parts are specified, each is interpreted as a byte of data and
     assigned, from left to right, to the four bytes of an Internet address.
     Note that when an Internet address is viewed as a 32-bit integer quantity
     on the VAX the bytes referred to above appear as “d.c.b.a”.  That is, VAX
     bytes are ordered from right to left.

     When a three part address is specified, the last part is interpreted as a
     16-bit quantity and placed in the least significant two bytes of the
     network address.

     When a two part address is supplied, the last part is interpreted as a
     24-bit quantity and placed in the least significant three bytes of the
     network address.

     When only one part is given, the value is stored directly in the network
     address without any byte rearrangement.

this is echoed by inet_net_ntop(3) -- same text.

so, i never liked this or understood it, and i did not preserve this syntax in
inet_pton(), but it's still documented, and i think we ought to either make
sure it isn't documented and never works anywhere, or that "route" should
support it.

i did preserve this in inet_net_pton(), so if "route" were to just use that,
then these examples (10/8 or even just 10) would work as seems to still be
expected. separately, inet_network() probably should use inet_net_pton() now.

-- 
You are receiving this mail because:
You are the assignee for the bug.