git: e44e611e31c3 - stable/13 - nfs: do not panic on bootpc_init when no interfaces are found
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 May 2022 12:14:46 UTC
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 <alfredo@FreeBSD.org> AuthorDate: 2022-04-07 22:33:26 +0000 Commit: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> 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