From b677399da165840fcbb1c3ecbee824f725276026 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 5 Mar 2026 12:37:00 +0000 Subject: [PATCH] [efi] Treat a URI device path as higher priority than a cached DHCP packet We currently expect to find either a cached DHCP packet (from a UEFI PXE boot) or a URI device path (from a UEFI HTTP boot), but not both simultaneously. When both are present, the cached DHCP packet will currently override any current working URI that was previously derived from a URI device path. Treat the URI device path as being more informative than the cached DHCP packet by swapping the order in which these are processed. Leave the boot option device path as being a lower priority than a cached DHCP packet, since the boot option device path may well refer to an earlier boot stage. Signed-off-by: Michael Brown --- src/interface/efi/efiprefix.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interface/efi/efiprefix.c b/src/interface/efi/efiprefix.c index 3c095afdc..8f5bf9d0a 100644 --- a/src/interface/efi/efiprefix.c +++ b/src/interface/efi/efiprefix.c @@ -85,15 +85,11 @@ static void efi_init_application ( void ) { EFI_DEVICE_PATH_PROTOCOL *bootpath; struct uri *uri; - /* Set current working URI from device path, if present */ + /* Set current working URI from boot option path, if present */ bootpath = efi_current_boot_path(); - DBGC ( device, "EFI has loaded image device path %s\n", - efi_devpath_text ( devpath ) ); DBGC ( device, "EFI has boot option device path %s\n", efi_devpath_text ( bootpath ) ); - uri = efi_path_uri ( devpath ); - if ( bootpath && ( ! uri ) ) - uri = efi_path_uri ( bootpath ); + uri = efi_path_uri ( bootpath ); if ( uri ) churi ( uri ); uri_put ( uri ); @@ -104,6 +100,14 @@ static void efi_init_application ( void ) { /* Store cached DHCP packet, if any */ efi_cachedhcp_record ( device, devpath ); + + /* Set current working URI from device path, if present */ + DBGC ( device, "EFI has loaded image device path %s\n", + efi_devpath_text ( devpath ) ); + uri = efi_path_uri ( devpath ); + if ( uri ) + churi ( uri ); + uri_put ( uri ); } /** EFI application initialisation function */