[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, 03 Oct 2021 21:35:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258874

Alexander V. Chernikov <melifaro@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |melifaro@FreeBSD.org

--- Comment #6 from Alexander V. Chernikov <melifaro@FreeBSD.org> ---
For the record, the previous behaviour was provided by the following code in
route.c:

```
        /*
         * MSB of net should be meaningful. 0/0 is exception.
         */
        if (net > 0)
                while ((net & 0xff000000) == 0)
                        net <<= 8;
```

https://cgit.freebsd.org/src/tree/sbin/route/route.c?h=stable/12#n1123


This part was removed as a classful bits cleanup here:
https://cgit.freebsd.org/src/commit/sbin/route/route.c?id=d28210b2c2aaf3200907ed30d296b0d4856dd03c


I have mixed opinions on that.
Using 10/8 or 240/4 is certainly convenient.
However, it effectively goes again the behaviour specified in inet(3), so it
may be a bit confusing for the people w/o muscular memory on remembering that
worked.
I'd rather prefer to leave it in a current state.

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