From nobody Wed Oct 05 21:14:59 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 4MjS5H5L3Lz4f5L9; Wed, 5 Oct 2022 21:14:59 +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 4MjS5H4cPGz3F6g; Wed, 5 Oct 2022 21:14:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665004499; 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=5L7UgLBaIbayFN2bSHPcAFgdZq5k7Q7fJPy2rFDSOco=; b=HPc+FJWhfu4FrEskIXuSRdbZUfGAaEYZI23zO7qoFZ3gRs1gCyc37CUubSytcpk3gIOMBP j9GiQw76Udb4MHEk1oRMxwdL6XWAvVbhBysGQaoCgpaenmWAZhhS1WUQqZPBvzcuvJvr3f 2ZhZBMMHJPZrlhsq+qHFC18+2xBQf/rcWYLkbGxVKAen7P1D+hdxYd+OjzdsOpEb4uhYLU ea5zATi5H5FQBJKZopsiSEAKdi61ULkDS1SrJF7bAgtqXsRUY6/B8RARMiRBVe/ssA5N7t BbU7SvaAepiV55Pw+FnHXO2NJU9RBZRlkMYsewEk04Xo/KCTtTYmFXqEJhBb7Q== 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 4MjS5H3VRqz12Tr; Wed, 5 Oct 2022 21:14:59 +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 295LExr1001034; Wed, 5 Oct 2022 21:14:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 295LExWc001033; Wed, 5 Oct 2022 21:14:59 GMT (envelope-from git) Date: Wed, 5 Oct 2022 21:14:59 GMT Message-Id: <202210052114.295LExWc001033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 4e6cf9ee5808 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e6cf9ee58080119fcd248681531ef1ca0fb5d53 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665004499; 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=5L7UgLBaIbayFN2bSHPcAFgdZq5k7Q7fJPy2rFDSOco=; b=IM2jcki832gAFRu1m6Lg1idHHuQ1G4DrnfKg7HfNB34YItaVSsmiBTaqkOPpCU42MMAcdp SJ7YfpYZDz6o1UMSHI4VqN8OHmdrX7ujGfivgN96GHzmgdBStD8rtWMSDXBMNFuWWs3X8x NNTfyaCzDOqQAR3AL2fdGO6DZhwjuPxGWKhyPPK5nnC+vYN20FSWmLSaokDCNKlbsxDKZ+ vQe7Tueh1FZALslVigA1TqE8FB6ESRbMB7M8r7b9YBHBX0VEmkZcojc8bcz4wP8fwBOcTC w60dp6bh4q+O8WQhB/GbqMsOkZdQmxnIeSXpYOgijvxNLpvZaw+/SgxbrG9hVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665004499; a=rsa-sha256; cv=none; b=H/xAH8byZJp0wRL++WeED7mzf0VMa/iI1V+lgHCAmNotxymCiXrpjnmpCiOf7VvmjF18kO /L8+gJTFhocmXH6uHx2JAQB2/3P6ob6JahoGU5KIYD9/Jh+vphwO17gPajiVMIk9Y+9ofD lhzY4cwdYyEc/V5Z/Cdq7aDKyYb+BR7MYO3LwWzBQrnGkfRgYgpsAibgfrLRIvkhphl6wu Vj/q/bWugRuxRT/TKgOF0BMPi93h98WPAT5kKvd6/OodKGYhYUiLkfW3hYRZWfj6L73aIy BOUVahbHuo1o+1G82hpAE8uBUa2Nca/RRMBJrZBfo70/VNkmKY/xDlAb6v5tQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=4e6cf9ee58080119fcd248681531ef1ca0fb5d53 commit 4e6cf9ee58080119fcd248681531ef1ca0fb5d53 Author: Alfredo Dal'Ava Junior AuthorDate: 2022-05-31 19:03:43 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2022-10-06 00:13:06 +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 (cherry picked from commit 3cb9f1976c260821e43e6eae9d46e4ec97a8d4f1) --- 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 cae6b7c30a71..8ce999ed5f21 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;