diff options
author | Michael Brown <mcb30@ipxe.org> | 2023-01-15 21:36:08 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2023-01-15 21:36:08 +0000 |
commit | 5a2fa6040e17562ce742df09aa20b8774b3879c5 (patch) | |
tree | 608b47590365c52ca7e6c767d32d6487689e7312 /src/interface/efi/efi_autoboot.c | |
parent | c4c03e5be867a9b7be4dc48fe6576deca1dce8d8 (diff) | |
download | ipxe-5a2fa6040e17562ce742df09aa20b8774b3879c5.tar.gz |
[autoboot] Include VLAN tag in filter for identifying autoboot device
When chainloading iPXE from a VLAN device, the MAC address of the
loaded image's device handle will match the MAC address of the trunk
device created by iPXE, and the autoboot process will then erroneously
consider the trunk device to be an autoboot device.
Fix by recording the VLAN tag along with the MAC address, and treating
the VLAN tag as part of the filter used to match the MAC address
against candidate network devices.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_autoboot.c')
-rw-r--r-- | src/interface/efi/efi_autoboot.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/interface/efi/efi_autoboot.c b/src/interface/efi/efi_autoboot.c index 08d67f761..ec7793cd7 100644 --- a/src/interface/efi/efi_autoboot.c +++ b/src/interface/efi/efi_autoboot.c @@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include <string.h> #include <errno.h> #include <ipxe/efi/efi.h> +#include <ipxe/efi/efi_path.h> #include <ipxe/efi/efi_autoboot.h> #include <ipxe/efi/Protocol/SimpleNetwork.h> #include <usr/autoboot.h> @@ -40,9 +41,11 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); * Identify autoboot device * * @v device Device handle + * @v path Device path * @ret rc Return status code */ -int efi_set_autoboot_ll_addr ( EFI_HANDLE device ) { +int efi_set_autoboot_ll_addr ( EFI_HANDLE device, + EFI_DEVICE_PATH_PROTOCOL *path ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; union { EFI_SIMPLE_NETWORK_PROTOCOL *snp; @@ -50,6 +53,7 @@ int efi_set_autoboot_ll_addr ( EFI_HANDLE device ) { } snp; EFI_SIMPLE_NETWORK_MODE *mode; EFI_STATUS efirc; + unsigned int vlan; int rc; /* Look for an SNP instance on the image's device handle */ @@ -66,10 +70,16 @@ int efi_set_autoboot_ll_addr ( EFI_HANDLE device ) { /* Record autoboot device */ mode = snp.snp->Mode; - set_autoboot_ll_addr ( &mode->CurrentAddress, mode->HwAddressSize ); + vlan = efi_path_vlan ( path ); + set_autoboot_ll_addr ( &mode->CurrentAddress, mode->HwAddressSize, + vlan ); DBGC ( device, "EFI %s found autoboot link-layer address:\n", efi_handle_name ( device ) ); DBGC_HDA ( device, 0, &mode->CurrentAddress, mode->HwAddressSize ); + if ( vlan ) { + DBGC ( device, "EFI %s found autoboot VLAN %d\n", + efi_handle_name ( device ), vlan ); + } /* Close protocol */ bs->CloseProtocol ( device, &efi_simple_network_protocol_guid, |