Re: review request: changing the default ifconfig(8) address format to CIDR

From: Lexi Winter <lexi_at_le-fay.org>
Date: Sat, 04 May 2024 19:50:39 UTC
Jessica Clarke:
> On 4 May 2024, at 16:34, Lexi Winter <lexi@le-fay.org> wrote:
> Do we need to care about supporting (/ do we currently support)
> historical non-contiguous netmasks? At a glance the CIDR code doesn’t
> handle that and will stop at the first 0, so changing to that by
> default would break such setups.

i have never had a need to try this, but i just tested it and it does
not appear to be supported at least in 15.0:

# ifconfig bridge2 create
# ifconfig bridge2 192.0.2.1 netmask 255.0.255.0
# ifconfig bridge2
bridge2: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
	options=0
	ether 58:9c:fc:00:16:69
	inet 192.0.2.1 netmask 0xffff0000 broadcast 192.0.255.255
	[snip]
# ifconfig bridge2 destroy
# ifconfig bridge2 create
# ifconfig bridge2 192.0.2.1 netmask 255.255.255.88
# ifconfig bridge2
bridge2: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
	options=0
	ether 58:9c:fc:00:16:69
	inet 192.0.2.1 netmask 0xffffffe0 broadcast 192.0.2.31
	[snip]

(0xffffffe0 = 255.255.255.224)

a quick Internet search suggests that non-contiguous netmasks were
deprecated when CIDR was introduced, so around 1993.