freebsd-src/sbin/route
Mike Karels b9e8ae1d8a route: error on IPv4 network routes with incorrect destination
Route destinations like 10/8 are most likely intended as a shorthand
for 10.0.0.0/8, but instead it means 0.0.0.10/8, which includes
only bits in the host part of the mask, and hence adds a route to
0.0.0.0/8.  In 12.x, there was code to "do what I mean", which was
removed as part of a cleanup of old network class remnants.  Given
that we have gone this long without that code, do not restore that
behavior.  Instead, detect the issue and produce an error.
Specifically, if there are no dots in a numeric IPv4 address, the
mask is specified with CIDR notation (using a slash), and there are
bits set in the host part, produce an error like this for 10/8:

    route: malformed address, bits set after mask; 10 means 0.0.0.10

PR:		258874
MFC after:	1 week
Reviewed by:	melifaro, emaste
Differential Revision:	https://reviews.freebsd.org/D43384
2024-01-15 15:14:54 -06:00
..
tests route: introduce add interface route test cases 2023-11-28 16:16:25 -05:00
keywords sbin: Remove ancient SCCS tags. 2023-11-26 22:23:29 -07:00
Makefile sbin: Remove ancient SCCS tags. 2023-11-26 22:23:29 -07:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
route.8 sbin: Remove ancient SCCS tags. 2023-11-26 22:23:29 -07:00
route.c route: error on IPv4 network routes with incorrect destination 2024-01-15 15:14:54 -06:00
route_netlink.c netlink: cope with growing requests 2023-10-17 08:47:52 +02:00