From nobody Tue May 31 19:07:43 2022 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 893E11B6087E; Tue, 31 May 2022 19:07:43 +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 4LCMH33PPFz3HRH; Tue, 31 May 2022 19:07:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654024063; 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=9bTFQALYU7f1Ru3Fx3slWNgcTa6sAALKPyaY4j8Jt34=; b=CxuM3f3SgjmVGXDi6i4AKTayZv4HGbCWXH1Iu82OZReZ6qM2Czwjf9MsZALujZ+oSEhugS p//ONetAvJQ9OJnVY1Zixj4Kt+wC0Y5OMplqUKiGgz0ldnrHw6e0xlzGYUUyWOi4lA9fWO IiNpmf9Zsf4/24Nl7f1wTT6SHBkhvNtml0PwDZp4MVGvtGI379nzWFLGT/b46Iv5n3bWOI 4D5aTgIZWyWAGEhFuhOevFKlq8xoVyODnIDGLMR+iUPPg3jjWuah8zAENhkLVkz3Vy7HVN 2gvDh//g5cEEzGNaBAtXQyB5JhvxSCLuqf7d1VJQNYPKKMI19BB92qb2k1rRMg== 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 544521187F; Tue, 31 May 2022 19:07:43 +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 24VJ7h0c072384; Tue, 31 May 2022 19:07:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24VJ7h5v072383; Tue, 31 May 2022 19:07:43 GMT (envelope-from git) Date: Tue, 31 May 2022 19:07:43 GMT Message-Id: <202205311907.24VJ7h5v072383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 3cb9f1976c26 - main - nfs: skip bootpc when vfs.root.mountfrom is other than nfs 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: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654024063; 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=9bTFQALYU7f1Ru3Fx3slWNgcTa6sAALKPyaY4j8Jt34=; b=sP9/3EH/EoL7Pavwa+Hx2gc0QByU82ZeergHFtb8Qx8Npw7RQ9g1dUxAgOz1FYjKp4X6Pz 0awBiDBqFBvfibkIOp64KgDpo0xewyPXR0QzCrtOqJYRkOFGBzpo/08tEyecZW0WHbL2Eu l95z9dslfsOEZ7zLsXu+mSH6HZMH/A+RUvvjFdypBfxYB+hHm17gxctm9y5drCuRMoPhZN eiHGqCagL5ns375nRPuVc6TWoLMnN8+QmyyOLqe7gQmCq5WkJOIjyylSrTkxeTiJddsUVf Pm6yXzhQb/HVB6g1MEq8HHCla8FWnD4deecVlMAm+1RfHFzeNJXgsg6t9WkqUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654024063; a=rsa-sha256; cv=none; b=AGTHl+4UjD2DqYTcDeTTaSEduLLCIkOcw36uowqc/Mpb+21wyHumXzqSow254vLSABUhVg 5WNh8lR/4ZBeKg1Ayi+piKLSUYXudoKrvRv8X88hrahAKiaKBRreRKYWnoQc+2KgB8Feuv Kwxw5dxxcWWu70hsL+f7MYG59ld00a2Gq1zcUPjKnoW8rFT1Chi2RRfoVtbo4yjwMJ6qxg v2s4+XwsgDHli0IwTMkDJarYdm1f01zderhdqBGrXKiN8akgO4KYPWRpLSpjLN+LCakxXR Nol/HPj6bdQOuo/1QuQXj3wmLPlQA136ZSIARCafQnDNQDVBiE7/RIIgi5ZqMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1 commit 3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1 Author: Alfredo Dal'Ava Junior AuthorDate: 2022-05-31 19:03:43 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2022-05-31 19:07:27 +0000 nfs: skip bootpc when vfs.root.mountfrom is other than nfs If "vfs.root.mountfrom" is set and the value is something other than "nfs:*", it means the user doesn't want to mount root via nfs, there's no reason to continue with bootpc This fixes the powerpcspe kernel (MPC85XXSPE) that's compiled with BOOTP_NFSROOT by default and gets stuck on bootpc/dhcp request loop when no DHCP server is available on the network, even when user specifies a local disk via "vfs.root.mountfrom" kernel parameter. Reviewed by: imp MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D35098 --- sys/nfs/bootp_subr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index e64a6b40640c..62fcb06fbc5d 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -1514,6 +1514,7 @@ bootpc_init(void) struct thread *td; int timeout; int delay; + char *s; timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz; delay = hz / 10; @@ -1527,6 +1528,21 @@ bootpc_init(void) if (nfs_diskless_valid != 0) return; + /* + * If "vfs.root.mountfrom" is set and the value is something other + * than "nfs:", it means the user doesn't want to mount root via nfs, + * there's no reason to continue with bootpc + */ + if ((s = kern_getenv("vfs.root.mountfrom")) != NULL) { + if ((strncmp(s, "nfs:", 4)) != 0) { + printf("%s: vfs.root.mountfrom set to %s. " + "BOOTP aborted.\n", __func__, s); + freeenv(s); + return; + } + freeenv(s); + } + gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO); STAILQ_INIT(&gctx->interfaces); gctx->xid = ~0xFFFF;