From nobody Tue Oct 19 14:47:40 2021 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4245217FCD81 for ; Tue, 19 Oct 2021 14:47:48 +0000 (UTC) (envelope-from mike@mail.karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4HYc6V5B7zz3LcQ for ; Tue, 19 Oct 2021 14:47:46 +0000 (UTC) (envelope-from mike@mail.karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.16.1/8.16.1) with ESMTPS id 19JElew2005172 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Tue, 19 Oct 2021 09:47:40 -0500 (CDT) (envelope-from mike@mail.karels.net) Received: (from mike@localhost) by mail.karels.net (8.16.1/8.16.1/Submit) id 19JElejZ005171; Tue, 19 Oct 2021 09:47:40 -0500 (CDT) (envelope-from mike) Message-Id: <202110191447.19JElejZ005171@mail.karels.net> To: freebsd-net@freebsd.org From: Mike Karels Reply-to: karels@FreeBSD.org Subject: cleaning up INET: deprecating network class A/B/C List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5169.1634654860.1@mail.karels.net> Date: Tue, 19 Oct 2021 09:47:40 -0500 X-Rspamd-Queue-Id: 4HYc6V5B7zz3LcQ X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of mike@mail.karels.net has no SPF policy when checking 216.160.39.52) smtp.mailfrom=mike@mail.karels.net X-Spamd-Result: default: False [2.29 / 15.00]; HAS_REPLYTO(0.00)[karels@FreeBSD.org]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[mike]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; REPLYTO_ADDR_EQ_FROM(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; TO_DN_NONE(0.00)[]; NEURAL_SPAM_SHORT(0.99)[0.992]; DMARC_NA(0.00)[FreeBSD.org]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[karels@FreeBSD.org,mike@mail.karels.net]; RCVD_NO_TLS_LAST(0.10)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:209, ipnet:216.160.36.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[karels@FreeBSD.org,mike@mail.karels.net]; TO_DOM_EQ_FROM_DOM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 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). 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). I am tempted to define a new default mask, e.g. 24 bits, for those places that must be able to generate one. An example is NFS BOOTP code. I am interested in feedback on this idea. It would help to reduce use of the old masks, and 8- or 16-bit prefixes are highly unlikely to be correct. Comments on adding a default mask? This would eliminate the use of the old class macros in the kernel. The C library routines inet_netof() and inet_lnaof() should be deprecated, as they use the historical masks. inet_makeaddr() is almost as bad; it works almost by accident as long as a mask is a multiple of 8 bits. I'd like to remove their use from the base system. Unfortunately, I have no idea how much other software uses them. We can at least document them as deprecated and unsafe. Mike