From nobody Fri May 06 12:14:46 2022 X-Original-To: dev-commits-src-branches@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 30FB71ABB95D; Fri, 6 May 2022 12:14:47 +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 4KvqJ70ldLz4ynM; Fri, 6 May 2022 12:14:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651839287; 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=tWPb1SXd/XWMLZeGvQRXlQHPvQf0m8RHH4lub+ksCf8=; b=nEPr0prxFoHtdUclvO63wvfJ87/wHZ1PFW4x5OyYWL+egHyPK5MoG+ihdnuuNej2V5zpnT f0QGsjGLyD2wQvGjjmHH21QTL/PzJ5Bp0n3PaUu5ZQu06gkMQnt86LFYvQnhnr6tHBaSmj YLfQrWxGS1nQKkpgEwfueEt6q5yOw1A+QF9CRqwDyx9qTsmhh3eShzkUUP1Z6uhbT+FNli kbruwTHPtrYxBgsMcpoVgUsgSTJ/QmffDw5OFNWS3tW9mqKsxqUJg084JJcluG49SZohkz GRtR/Fz0NYvlzWMd2tEKBwgcVteVm3G+GELYx7H2QD1w3teSfpoUGllkhz65nQ== 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 EE3521BB1B; Fri, 6 May 2022 12:14:46 +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 246CEkNK066829; Fri, 6 May 2022 12:14:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 246CEkYR066828; Fri, 6 May 2022 12:14:46 GMT (envelope-from git) Date: Fri, 6 May 2022 12:14:46 GMT Message-Id: <202205061214.246CEkYR066828@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: e44e611e31c3 - stable/13 - nfs: do not panic on bootpc_init when no interfaces are found List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: e44e611e31c3ac3c36ee33af37e7159b5dd2be13 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651839287; 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=tWPb1SXd/XWMLZeGvQRXlQHPvQf0m8RHH4lub+ksCf8=; b=mJ6UsPe9Uw0xb0uafgdV2D5Ph1wEycdN+tfk1BZuHbJVbedd59YoVTE3jh9844SeA3asd6 ZPtErlXaTGYKtq9tnT2vnjPqoGaRXUXVjmrdNg86Mv3jxqwostCy5ScVfcZ+JEWjn9/HNi AARwMDLM7Rfvd3AJ0eY3IdnTOtRZDWTdv9AFXx8VkMtpclOtFwZYpP8UaV6oKMItmfjGS8 JDTT5Vnc754hFCyLyr+yfkPCqLfpuLa9fTlSUEAHX1L+qT7vimltTgXeQyuuAuFY5a4OgY 5ultojvigELKKyYXebKa5PCi+Ne64HxrGzUbL9UyG7ElVtw4ylQlU1yevBNEpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651839287; a=rsa-sha256; cv=none; b=FuFmDyduSn5YPOtxNO2TwvNcRdk+LSB9U7azd2IbERrETGrAoB/SHw6dAbi9k4i4sF4gbu 1vc2NoPtNKpaEoj/qx0pUJxkPqOEMA9RvxJZc0B5K1RQpt44U2ZzjjT+/uOGxcnuIQwF/q stM9gsCo/VrdVdhP4NH+3PtGl1GqY2Yy+TGlyhtf6FL6k5b4Mwtq3VIWxYeS/fBQM4XOML 1i0hswReWv7pjuho+CM+/42a1yyZhex9cJRHnrs0Hb1csW6b4YwkQDj6grAUmKfPMiDe6W BjGPpx8EuKb1RZYClMKgvTuI0inCnhmqTEr8lb4+CNNPXQaYS1W/NfR+OXUsbw== 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=e44e611e31c3ac3c36ee33af37e7159b5dd2be13 commit e44e611e31c3ac3c36ee33af37e7159b5dd2be13 Author: Alfredo Dal'Ava Junior AuthorDate: 2022-04-07 22:33:26 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2022-05-06 12:14:28 +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 (cherry picked from commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe) --- 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 a012bc914aa5..a05f33a55a71 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -1504,7 +1504,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; @@ -1574,9 +1574,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