dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0171-efinet-UEFI-IPv6-PXE-support.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Michael Chang <mchang@suse.com>
8631a2
Date: Wed, 15 Apr 2015 14:48:30 +0800
8631a2
Subject: [PATCH] efinet: UEFI IPv6 PXE support
8631a2
8631a2
When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is
8631a2
cached in firmware buffer which can be obtained by PXE Base Code protocol. The
8631a2
network interface can be setup through the parameters in that obtained packet.
8631a2
8631a2
Signed-off-by: Michael Chang <mchang@suse.com>
8631a2
Signed-off-by: Ken Lin <ken.lin@hpe.com>
8631a2
---
8631a2
 grub-core/net/drivers/efi/efinet.c |  2 ++
8631a2
 include/grub/efi/api.h             | 71 +++++++++++++++++++++++---------------
8631a2
 2 files changed, 46 insertions(+), 27 deletions(-)
8631a2
8631a2
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
8631a2
index 6fd0a4f4998..712b4f85962 100644
8631a2
--- a/grub-core/net/drivers/efi/efinet.c
8631a2
+++ b/grub-core/net/drivers/efi/efinet.c
8631a2
@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
8631a2
 	  grub_print_error ();
8631a2
 	if (device && path)
8631a2
 	  grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
8631a2
+	if (grub_errno)
8631a2
+	  grub_print_error ();
8631a2
       }
8631a2
     else
8631a2
       {
8631a2
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
8631a2
index 1250d493e25..2f164d4209c 100644
8631a2
--- a/include/grub/efi/api.h
8631a2
+++ b/include/grub/efi/api.h
8631a2
@@ -1499,31 +1499,6 @@ typedef union
8631a2
   grub_efi_pxe_dhcpv6_packet_t dhcpv6;
8631a2
 } grub_efi_pxe_packet_t;
8631a2
 
8631a2
-#define GRUB_EFI_PXE_MAX_IPCNT 8
8631a2
-#define GRUB_EFI_PXE_MAX_ARP_ENTRIES 8
8631a2
-#define GRUB_EFI_PXE_MAX_ROUTE_ENTRIES 8
8631a2
-
8631a2
-typedef struct grub_efi_pxe_ip_filter
8631a2
-{
8631a2
-  grub_efi_uint8_t filters;
8631a2
-  grub_efi_uint8_t ip_count;
8631a2
-  grub_efi_uint16_t reserved;
8631a2
-  grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_MAX_IPCNT];
8631a2
-} grub_efi_pxe_ip_filter_t;
8631a2
-
8631a2
-typedef struct grub_efi_pxe_arp_entry
8631a2
-{
8631a2
-  grub_efi_ip_address_t ip_addr;
8631a2
-  grub_efi_mac_address_t mac_addr;
8631a2
-} grub_efi_pxe_arp_entry_t;
8631a2
-
8631a2
-typedef struct grub_efi_pxe_route_entry
8631a2
-{
8631a2
-  grub_efi_ip_address_t ip_addr;
8631a2
-  grub_efi_ip_address_t subnet_mask;
8631a2
-  grub_efi_ip_address_t gateway_addr;
8631a2
-} grub_efi_pxe_route_entry_t;
8631a2
-
8631a2
 typedef struct grub_efi_pxe_icmp_error
8631a2
 {
8631a2
   grub_efi_uint8_t type;
8631a2
@@ -1549,6 +1524,48 @@ typedef struct grub_efi_pxe_tftp_error
8631a2
   grub_efi_char8_t error_string[127];
8631a2
 } grub_efi_pxe_tftp_error_t;
8631a2
 
8631a2
+typedef struct {
8631a2
+  grub_uint8_t addr[4];
8631a2
+} grub_efi_pxe_ipv4_address_t;
8631a2
+
8631a2
+typedef struct {
8631a2
+  grub_uint8_t addr[16];
8631a2
+} grub_efi_pxe_ipv6_address_t;
8631a2
+
8631a2
+typedef struct {
8631a2
+  grub_uint8_t addr[32];
8631a2
+} grub_efi_pxe_mac_address_t;
8631a2
+
8631a2
+typedef union {
8631a2
+  grub_uint32_t addr[4];
8631a2
+  grub_efi_pxe_ipv4_address_t v4;
8631a2
+  grub_efi_pxe_ipv6_address_t v6;
8631a2
+} grub_efi_pxe_ip_address_t;
8631a2
+
8631a2
+#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
8631a2
+typedef struct grub_efi_pxe_ip_filter
8631a2
+{
8631a2
+  grub_efi_uint8_t filters;
8631a2
+  grub_efi_uint8_t ip_count;
8631a2
+  grub_efi_uint16_t reserved;
8631a2
+  grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT];
8631a2
+} grub_efi_pxe_ip_filter_t;
8631a2
+
8631a2
+typedef struct {
8631a2
+  grub_efi_pxe_ip_address_t ip_addr;
8631a2
+  grub_efi_pxe_mac_address_t mac_addr;
8631a2
+} grub_efi_pxe_arp_entry_t;
8631a2
+
8631a2
+typedef struct {
8631a2
+  grub_efi_pxe_ip_address_t ip_addr;
8631a2
+  grub_efi_pxe_ip_address_t subnet_mask;
8631a2
+  grub_efi_pxe_ip_address_t gw_addr;
8631a2
+} grub_efi_pxe_route_entry_t;
8631a2
+
8631a2
+
8631a2
+#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
8631a2
+#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
8631a2
+
8631a2
 typedef struct grub_efi_pxe_mode
8631a2
 {
8631a2
   grub_efi_boolean_t started;
8631a2
@@ -1580,9 +1597,9 @@ typedef struct grub_efi_pxe_mode
8631a2
   grub_efi_pxe_packet_t pxe_bis_reply;
8631a2
   grub_efi_pxe_ip_filter_t ip_filter;
8631a2
   grub_efi_uint32_t arp_cache_entries;
8631a2
-  grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_MAX_ARP_ENTRIES];
8631a2
+  grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
8631a2
   grub_efi_uint32_t route_table_entries;
8631a2
-  grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_MAX_ROUTE_ENTRIES];
8631a2
+  grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
8631a2
   grub_efi_pxe_icmp_error_t icmp_error;
8631a2
   grub_efi_pxe_tftp_error_t tftp_error;
8631a2
 } grub_efi_pxe_mode_t;