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
This commit is contained in:
Alfredo Dal'Ava Junior 2022-04-07 19:33:26 -03:00
parent 9df5f29caf
commit 0b1b30d664

View File

@ -1501,7 +1501,7 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
void void
bootpc_init(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 bootpc_globalcontext *gctx; /* Global BOOTP context */
struct ifnet *ifp; struct ifnet *ifp;
struct sockaddr_dl *sdl; struct sockaddr_dl *sdl;
@ -1571,9 +1571,13 @@ bootpc_init(void)
} }
ifcnt++; ifcnt++;
} }
IFNET_RUNLOCK(); IFNET_RUNLOCK();
if (ifcnt == 0) if (ifcnt == 0) {
panic("%s: no eligible interfaces", __func__); printf("WARNING: BOOTP found no eligible network interfaces, skipping!\n");
goto out;
}
for (; ifcnt > 0; ifcnt--) for (; ifcnt > 0; ifcnt--)
allocifctx(gctx); allocifctx(gctx);
#endif #endif