[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 <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2026-03-05 12:37:00 +00:00
parent 8df45c2f3b
commit b677399da1

View File

@ -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 */