diff options
author | jhb <jhb@FreeBSD.org> | 2016-05-26 23:08:57 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-05-26 23:08:57 +0000 |
commit | 8c87c3cb87bb9ab932965b629bc4eaf71f7de7cb (patch) | |
tree | 639a4a5421487baaf86a01c6d4f1a3a338575c31 /sys/boot/efi | |
parent | e075851d35de03a4c8259fef7bf5e99d58088d06 (diff) | |
download | FreeBSD-src-8c87c3cb87bb9ab932965b629bc4eaf71f7de7cb.zip FreeBSD-src-8c87c3cb87bb9ab932965b629bc4eaf71f7de7cb.tar.gz |
Use a unique error message if we fail to find the simple network protocol.
While here, fix the various net driver callbacks to return early instead
of crashing if this fails. (The 'init' callback from the netif interface
doesn't return an error if the protocol lookup fails.)
Sponsored by: Cisco Systems
Diffstat (limited to 'sys/boot/efi')
-rw-r--r-- | sys/boot/efi/libefi/efinet.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/boot/efi/libefi/efinet.c b/sys/boot/efi/libefi/efinet.c index 6f3f5a0..aa7033a 100644 --- a/sys/boot/efi/libefi/efinet.c +++ b/sys/boot/efi/libefi/efinet.c @@ -122,6 +122,8 @@ efinet_put(struct iodesc *desc, void *pkt, size_t len) void *buf; net = nif->nif_devdata; + if (net == NULL) + return (-1); status = net->Transmit(net, 0, len, pkt, 0, 0, 0); if (status != EFI_SUCCESS) @@ -152,6 +154,8 @@ efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) char buf[2048]; net = nif->nif_devdata; + if (net == NULL) + return (0); t = time(0); while ((time(0) - t) < timeout) { @@ -192,7 +196,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata); if (status != EFI_SUCCESS) { - printf("net%d: cannot start interface (status=%lu)\n", + printf("net%d: cannot fetch interface data (status=%lu)\n", nif->nif_unit, EFI_ERROR_CODE(status)); return; } @@ -241,6 +245,9 @@ efinet_end(struct netif *nif) { EFI_SIMPLE_NETWORK *net = nif->nif_devdata; + if (net == NULL) + return; + net->Shutdown(net); } |