]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Create VLAN autoboot device automatically
authorMichael Brown <mcb30@ipxe.org>
Sun, 15 Jan 2023 22:42:30 +0000 (22:42 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 15 Jan 2023 22:42:30 +0000 (22:42 +0000)
When chainloading iPXE from an EFI VLAN device, configure the
corresponding iPXE VLAN device to be created automatically.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_autoboot.c

index ec7793cd71c069d6dbaf46bb562c5dfd61150b36..a103c2f19779956c133d75497fb1d11b130acc3b 100644 (file)
@@ -25,6 +25,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
 #include <string.h>
 #include <errno.h>
+#include <ipxe/if_ether.h>
+#include <ipxe/vlan.h>
 #include <ipxe/efi/efi.h>
 #include <ipxe/efi/efi_path.h>
 #include <ipxe/efi/efi_autoboot.h>
@@ -81,6 +83,13 @@ int efi_set_autoboot_ll_addr ( EFI_HANDLE device,
                       efi_handle_name ( device ), vlan );
        }
 
+       /* Configure automatic VLAN device, if applicable */
+       if ( vlan && ( mode->HwAddressSize == ETH_ALEN ) ) {
+               vlan_auto ( &mode->CurrentAddress, vlan );
+               DBGC ( device, "EFI %s configured automatic VLAN %d\n",
+                      efi_handle_name ( device ), vlan );
+       }
+
        /* Close protocol */
        bs->CloseProtocol ( device, &efi_simple_network_protocol_guid,
                            efi_image_handle, NULL );