Date: Thu, 7 Apr 2022 22:37:41 GMT From: "Alfredo Dal'Ava Junior" <alfredo@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 0b1b30d66450 - main - nfs: do not panic on bootpc_init when no interfaces are found Message-ID: <202204072237.237Mbf4Z064732@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe Author: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> AuthorDate: 2022-04-07 22:33:26 +0000 Commit: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204072237.237Mbf4Z064732>