From nobody Thu Apr 07 22:37:41 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 E2D401A9ABB1; Thu, 7 Apr 2022 22:37:41 +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 4KZGVF62x0z4VMB; Thu, 7 Apr 2022 22:37:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649371061; 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=3vtr2RTdAA99iUNoT1UHWx8iJ6cQMRDE3gzgtrH8vhg=; b=S/cir/dBa7RlFcP9dN9Kc6CXhSoCsUfVvkRG9eYyhba1cy1c6Gsgac7iFVafC/CxJzf56g GrCfI+bU+FbJP9i824jGAsziYxaIiSgBaiEDd364Q8q4m+KR8an9cDGhbLKUCLVxygB4vc 99H/JF43//7t9cLF1nUGX0ireISn+jo6MpM15s1/v1lJFCPc7kCxDY/w3mSDVbFW5Haj8w W6Xwh252VRHDH6L458GC2Mf8WzkInycKJyd3MSbbKyIVDbrWgYK5FZHLgUkq49N/nZYgGY fQ+JzDpHUTvq1Kjk1Wm+AZtWuMtssujr6KQFm6/eHxWMyZSrJuUHfurqNAmkSw== 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 A9D2318E53; Thu, 7 Apr 2022 22:37:41 +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 237MbfrX064733; Thu, 7 Apr 2022 22:37:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 237Mbf4Z064732; Thu, 7 Apr 2022 22:37:41 GMT (envelope-from git) Date: Thu, 7 Apr 2022 22:37:41 GMT Message-Id: <202204072237.237Mbf4Z064732@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: 0b1b30d66450 - main - nfs: do not panic on bootpc_init when no interfaces are found 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: 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649371061; 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=3vtr2RTdAA99iUNoT1UHWx8iJ6cQMRDE3gzgtrH8vhg=; b=EoKVrqVhWNdDiSV46y0ldJV94ptU4yQB5fNzTapIFL3aa1p7kd8toOFYoBCpm2rFaQl6gh K9ULwXpCmOP6AGFHu3g4zqr/rND3KVSDXymrd1pwGfD5XsZUA7zAW4BIiln6A75+BFQ69E 0pDJWFn5v78jD5niHj4/urssL2i7LkoPweMTznYQrwO5K2k1RdSfTytUYhw+k0b82Qehk4 je55FTzoMd0Ywti5GtDoPXGoxbLgwaUXCyxwzwJS9rhFDzZAemIKBbSHwSuq0UyaGtcgd8 Y7UyaewkE18QFz5JjevPP7fyG1h0RZzUMNpXYzgFhsG31IY2Quq8uUF/ek6kQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649371061; a=rsa-sha256; cv=none; b=NHt9/G4915oRj5y5g+rDqsUoQ2vZUqGAOYGAdb7ZyGqfIqAWDzQLnf6/PZvud9LcFctaEC X8EiIdg3LnVy0gT4NkQxoV7w47vFev4QF2Bc//ON3j4ulyQjSx5K0ZZ0T1n4UsSnZr4YPY f4GuT4AvE36Junnt9i3Td6d0k13df/8J8hrSgRhghcehG8gM6SghleE5lAR2ZEWM1R8LmF +oUngMOwv1nKnAlU/Lz+k0kum8EvdORSaSF+pH+3iOlMVySNS0eMxrFBdvH0nT22eQrA3n DV7EI23gTCd3ZLGYUZrtNF9tFxu3v3nhaj1AsoZP9U8y8DOPvoyRAQ0tHEl1Eg== 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=0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe Author: Alfredo Dal'Ava Junior AuthorDate: 2022-04-07 22:33:26 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2022-04-07 22:33:26 +0000 nfs: do not panic on bootpc_init when no interfaces are found Replaces panic with a warning message to allow kernel continue when no bootp eligible network interfaces are found. This avoids having to build a custom kernel when using a local root file system on targets like powerpcspe that expects bootp/NFS by default. Reviewed by: rmacklem MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D34567 --- sys/nfs/bootp_subr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index 62b864efa60b..e64a6b40640c 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -1501,7 +1501,7 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx, void bootpc_init(void) { - struct bootpc_ifcontext *ifctx; /* Interface BOOTP contexts */ + struct bootpc_ifcontext *ifctx = NULL; /* Interface BOOTP contexts */ struct bootpc_globalcontext *gctx; /* Global BOOTP context */ struct ifnet *ifp; struct sockaddr_dl *sdl; @@ -1571,9 +1571,13 @@ bootpc_init(void) } ifcnt++; } + IFNET_RUNLOCK(); - if (ifcnt == 0) - panic("%s: no eligible interfaces", __func__); + if (ifcnt == 0) { + printf("WARNING: BOOTP found no eligible network interfaces, skipping!\n"); + goto out; + } + for (; ifcnt > 0; ifcnt--) allocifctx(gctx); #endif