aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-04-15 14:28:38 +0100
committerMichael Brown <mcb30@ipxe.org>2024-04-15 14:28:38 +0100
commit27ecc36c0bef804d12dbf8c29684c8e8159c8e47 (patch)
tree99c074d533ab2d7531258c5b7b488379586fcc19
parent59f27d69358efc919b50760f3d6dac0b637b5488 (diff)
downloadipxe-27ecc36c0bef804d12dbf8c29684c8e8159c8e47.zip
ipxe-27ecc36c0bef804d12dbf8c29684c8e8159c8e47.tar.gz
ipxe-27ecc36c0bef804d12dbf8c29684c8e8159c8e47.tar.bz2
[efi] Do not attempt to download autoexec.ipxe without a valid base URI
If we do not have a current working URI (after applying the EFI device path settings and any cached DHCP settings), then an attempt to download autoexec.ipxe will fail since there is no base URI from which to resolve the full autoexec.ipxe URI. Avoid this potentially confusing error message by attempting the download only if we have successfully obtained a current working URI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/interface/efi/efi_autoexec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/interface/efi/efi_autoexec.c b/src/interface/efi/efi_autoexec.c
index d9ad3b9..44b8b64 100644
--- a/src/interface/efi/efi_autoexec.c
+++ b/src/interface/efi/efi_autoexec.c
@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/timer.h>
#include <ipxe/image.h>
#include <ipxe/netdevice.h>
+#include <ipxe/uri.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_utils.h>
#include <ipxe/efi/efi_autoexec.h>
@@ -111,6 +112,14 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) {
goto err_create;
}
+ /* Do nothing unless we have a usable current working URI */
+ if ( ! cwuri ) {
+ DBGC ( device, "EFI %s has no current working URI\n",
+ efi_handle_name ( device ) );
+ rc = -ENOTTY;
+ goto err_cwuri;
+ }
+
/* Open network device */
if ( ( rc = netdev_open ( netdev ) ) != 0 ) {
DBGC ( device, "EFI %s could not open net device: %s\n",
@@ -130,6 +139,7 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) {
sync ( EFI_AUTOEXEC_TIMEOUT );
err_open:
+ err_cwuri:
mnptemp_destroy ( netdev );
err_create:
return rc;