Re: cleaning up INET: deprecating network class A/B/C

From: Michael Gmelin <freebsd_at_grem.de>
Date: Wed, 20 Oct 2021 04:02:04 UTC

> On 19. Oct 2021, at 23:16, Mike Karels <karels@freebsd.org> wrote:
> 
> Rod wrote:
> 
>>> I plan to do some cleanup of the residual code defining and using the
>>> old Internet network classes (A/B/C), which have been obsolete since
>>> CIDR took hold.  This is an outline of what I plan, as it will happen
>>> in a number of steps and reviews, and I would like feedback on some
>>> of it.
>>> 
>>> I want to reduce the use of the obsolete definitions and interfaces,
>>> and make it less likely for them to be used going forward.  I plan
>>> to hide the Class A/B/C bit definitions unless a feature test macro
>>> is defined; that will be the default for user code for the moment.
>>> A few files in the kernel will need to define the feature test macro
>>> for now (but see the next two paragraphs).
> 
>> Sounds good.
> 
>>> 
>>> Several of the uses of the historical network class macros have to
>>> do with generating a default network mask when none is provided.
>>> The worst of these is in the code for SIOCAIFADDR (add interface
>>> address).  I want to have ifconfig and/or the kernel warn about this;
>>> the default is most likely wrong.  After some time with a warning,
>>> it should become an error to set an Internet interface address
>>> without a mask (except for loopback and point-to-point interfaces,
>>> where the mask is meaningless).
> 
>> Sounds good except that last bit, mask on loopback is
>> meaningful, especially for people like me that alrady
>> have modified systems that change loopback from 127/8
>> to 127/16.
> 
> I'm not aware of anything that uses the mask on a loopback interface;
> are you?  There is no network route installed when the loopback address
> is set.  I think it's similar for point-to-point interfaces, where only
> the host route for the destination is added.
> 

I’ve got a use case that depends on being able to set and read the netmask on loopback interfaces consistently to allow orchestration and nomad fingerprinters to pick it up. But that’s really only about those operations.

Best
Michael