The branch main has been updated by alfredo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe

commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe
Author:     Alfredo Dal'Ava Junior <[email protected]>
AuthorDate: 2022-04-07 22:33:26 +0000
Commit:     Alfredo Dal'Ava Junior <[email protected]>
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

Reply via email to