Print VLAN info in EFI device path
PATCH 1/2 Print VLAN info in EFI device path
Signed-off-by Chad Kimes <[email protected]>
--- grub-core/kern/efi/efi.c | 7 +++++++ include/grub/efi/api.h | 9 +++++++++ 2 files changed, 16 insertions(+)
grub-core/kern/efi/efi.c +7 -0
@@ -832,6 +832,13 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) sata->lun); }break ; +case GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE : + { +grub_efi_vlan_device_path_t *vlan; + vlan = (grub_efi_vlan_device_path_t *) dp; +grub_printf ("/Vlan(%u)" , vlan->vlan_id); + } +break ;case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE : dump_vendor_path ("Messaging",
include/grub/efi/api.h +9 -0
@@ -903,6 +903,15 @@ struct grub_efi_sata_device_path }GRUB_PACKED ;typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t ; +#define GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE 20 + +struct grub_efi_vlan_device_path +{ +grub_efi_device_path_t header; +grub_efi_uint16_t vlan_id; +}GRUB_PACKED ; +typedef struct grub_efi_vlan_device_path grub_efi_vlan_device_path_t ; +#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10/* Media Device Path. */
Signature · 1 line
2.25.1
PATCH 2/2 Configure VLAN from UEFI device used for PXE
Signed-off-by Chad Kimes <[email protected]>
--- grub-core/net/drivers/efi/efinet.c | 38 ++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-)
grub-core/net/drivers/efi/efinet.c +33 -5
@@ -387,11 +387,39 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,if (! pxe)continue ; pxe_mode = pxe->mode; -grub_net_configure_by_dhcp_ack (card->name, card,0 , - (struct grub_net_bootp_packet *) - &pxe_mode->dhcp_ack, -sizeof (pxe_mode->dhcp_ack), -1 , device, path); + +struct grub_net_network_level_interface *inter; + inter =grub_net_configure_by_dhcp_ack (card->name, card,0 , + (struct grub_net_bootp_packet *) + &pxe_mode->dhcp_ack, +sizeof (pxe_mode->dhcp_ack), +1 , device, path); + +if (inter) + { +/* +* search the device path for any VLAN subtype and use it +* to configure the interface +*/ +grub_efi_uint16_t len; +grub_efi_device_path_t *vlan_dp; + vlan_dp = dp; + +while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp)) + { +if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) ==GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE + &&GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) ==GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE ) + { +grub_efi_vlan_device_path_t *vlan; + vlan = (grub_efi_vlan_device_path_t *) vlan_dp; + inter->vlantag = vlan->vlan_id; +break ; + } + + len =GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp); + vlan_dp = (grub_efi_device_path_t *) ((char *) vlan_dp + len); + } + }return ; } }
Signature · 1 line
2.25.1