netif_open: Fail with ENXIO instead of panic if no netif available
Avoid undesirable freeze for efiboot/x86 when interfaces are really unavailable, or fail to be configured by buggy UEFI firmware.
This commit is contained in:
parent
3029494a69
commit
701cc34a36
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netif.c,v 1.26 2019/03/31 20:08:45 christos Exp $ */
|
||||
/* $NetBSD: netif.c,v 1.27 2023/09/14 03:08:31 rin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Adam Glass
|
||||
|
@ -292,8 +292,10 @@ fnd:
|
|||
(void)memset(s, 0, sizeof(*s));
|
||||
netif_init();
|
||||
nif = netif_select(machdep_hint);
|
||||
if (!nif)
|
||||
panic("netboot: no interfaces left untried");
|
||||
if (!nif) {
|
||||
errno = ENXIO;
|
||||
return -1;
|
||||
}
|
||||
if (netif_probe(nif, machdep_hint)) {
|
||||
printf("%s: couldn't probe %s%d\n", __func__,
|
||||
nif->nif_driver->netif_bname, nif->nif_unit);
|
||||
|
|
Loading…
Reference in New Issue