From nobody Fri Dec 10 16:29:18 2021 X-Original-To: dev-commits-src-all@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 B49D318D6B37; Fri, 10 Dec 2021 16:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9bvg2DDbz3FFD; Fri, 10 Dec 2021 16:29:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E40C11D946; Fri, 10 Dec 2021 16:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BAGTIZ1077083; Fri, 10 Dec 2021 16:29:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BAGTIE0077082; Fri, 10 Dec 2021 16:29:18 GMT (envelope-from git) Date: Fri, 10 Dec 2021 16:29:18 GMT Message-Id: <202112101629.1BAGTIE0077082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: c25b0c36dd1e - stable/13 - kernel: partially revert e9efb1125a15, default inet mask List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c25b0c36dd1ee432ad226e9af577a8fcf1572831 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639153760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5oXMzPRQzXY/8orcrcHiiizaoM7aloppmq4UHD6vQNc=; b=dfjLzAbdZWyfBCu2YGbG4SIkbTg5VZzaBH3OXNBNZt/5en2YBa4M4cBw3ErhzSSFSVXZXV sNopeWC8r/2oL64eB2vOf35W+R9XwZNrkjmcKm/uMVVdZ+o/2c23GgM+bDaTQc+DBaDcqk 8fVJw3X29aRXxNQnDzWMZg/8i3WegJ3T8608pUgfgPOGq8eSTFQHuA6ACW8cCKSiKq1NsQ lNa5rmLbzB2P94vV1DzBrB3Ni3+8IVDe2T+WWSesgAuvgKI4J/w1S8UrrVAmfQHblSWxQx 7jD/vImT39EVWpSkg1s3GQj8PNaeTaVhOd1Px/ZgNZz1nc9KAYw4/kIJZBRjwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639153760; a=rsa-sha256; cv=none; b=FUyJS/0D59L47GSHRCE0Fn2bM/wEsKsERgviLQsgILtB1zxrgEXOMHyMgFik5WZpXEcBzy 7pCgjY8+cUoUaM8xbn68LriVxEdzDsD1X1BkR4R6hMuGThQyYaoxrkX9NRDzN75j21UVvT jum2WwSRFus/zi0PmUrCQ4lxTF4L9mZGVpSj3s4LqgckbCwBDvpJV6Vg6FQ9j6AUcKXdFs 4ROIrZoodiZcmH0hXhL9v9rfSosLZ7uX7ANTxtCv57zdxjzMJvz1fJ5MnJW9MVuK4G8Hf6 5qDvEN6Y0W9kxWTQR0377Cw26C1vxQamEx8YA+TGTCzRwKj6b2jY59NUJbFmIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=c25b0c36dd1ee432ad226e9af577a8fcf1572831 commit c25b0c36dd1ee432ad226e9af577a8fcf1572831 Author: Mike Karels AuthorDate: 2021-11-10 21:35:33 +0000 Commit: Mike Karels CommitDate: 2021-12-10 16:28:06 +0000 kernel: partially revert e9efb1125a15, default inet mask When no mask is supplied to the ioctl adding an Internet interface address, revert to using the historical class mask rather than a single default. Similarly for the NFS bootp code. (cherry picked from commit 2f35e7d9fa03f27543f347cd6277af5bfc6a7e95) --- sys/netinet/in.c | 17 +++++++++++++---- sys/nfs/bootp_subr.c | 13 ++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 3cf1504097bd..5448c3b5fccd 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -35,6 +35,8 @@ #include __FBSDID("$FreeBSD$"); +#define IN_HISTORICAL_NETS /* include class masks */ + #include #include #include @@ -458,17 +460,24 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) ia->ia_sockmask = *mask; ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr); } else { + in_addr_t i = ntohl(addr->sin_addr.s_addr); + /* - * If netmask isn't supplied, use default for now. + * If netmask isn't supplied, use historical default. * This is deprecated for interfaces other than loopback * or point-to-point; warn in other cases. In the future * we should return an error rather than warning. */ if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) - printf("%s: set address: WARNING: network mask" - " should be specified; using default mask\n", + printf("%s: set address: WARNING: network mask " + "should be specified; using historical default\n", ifp->if_xname); - ia->ia_subnetmask = IN_NETMASK_DEFAULT; + if (IN_CLASSA(i)) + ia->ia_subnetmask = IN_CLASSA_NET; + else if (IN_CLASSB(i)) + ia->ia_subnetmask = IN_CLASSB_NET; + else + ia->ia_subnetmask = IN_CLASSC_NET; ia->ia_sockmask.sin_addr.s_addr = htonl(ia->ia_subnetmask); } ia->ia_subnet = ntohl(addr->sin_addr.s_addr) & ia->ia_subnetmask; diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index 0067efa81106..a012bc914aa5 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -42,6 +42,8 @@ * $NetBSD: krpc_subr.c,v 1.10 1995/08/08 20:43:43 gwr Exp $ */ +#define IN_HISTORICAL_NETS /* include class masks */ + #include __FBSDID("$FreeBSD$"); @@ -1486,11 +1488,16 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx, if (ifctx->gotnetmask == 0) { /* - * If there is no netmask, use a default, but we really - * need the right mask from the server. + * If there is no netmask, use historical default, + * but we really need the right mask from the server. */ printf("%s: no netmask received!\n", ifctx->ireq.ifr_name); - ifctx->netmask.sin_addr.s_addr = htonl(IN_NETMASK_DEFAULT); + if (IN_CLASSA(ntohl(ifctx->myaddr.sin_addr.s_addr))) + ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(ifctx->myaddr.sin_addr.s_addr))) + ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSB_NET); + else + ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSC_NET); } }