Blame SOURCES/0266-efinet-Setting-network-from-UEFI-device-path.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Michael Chang <mchang@suse.com>
f725e3
Date: Sun, 10 Jul 2016 23:46:31 +0800
f725e3
Subject: [PATCH] efinet: Setting network from UEFI device path
f725e3
f725e3
The PXE Base Code protocol used to obtain cached PXE DHCPACK packet is no
f725e3
longer provided for HTTP Boot. Instead, we have to get the HTTP boot
f725e3
information from the device path nodes defined in following UEFI Specification
f725e3
sections.
f725e3
f725e3
 9.3.5.12 IPv4 Device Path
f725e3
 9.3.5.13 IPv6 Device Path
f725e3
 9.3.5.23 Uniform Resource Identifiers (URI) Device Path
f725e3
f725e3
This patch basically does:
f725e3
f725e3
include/grub/efi/api.h:
f725e3
Add new structure of Uniform Resource Identifiers (URI) Device Path
f725e3
f725e3
grub-core/net/drivers/efi/efinet.c:
f725e3
Check if PXE Base Code is available, if not it will try to obtain the netboot
f725e3
information from the device path where the image booted from. The DHCPACK
f725e3
packet is recoverd from the information in device patch and feed into the same
f725e3
DHCP packet processing functions to ensure the network interface is setting up
f725e3
the same way it used to be.
f725e3
f725e3
Signed-off-by: Michael Chang <mchang@suse.com>
f725e3
Signed-off-by: Ken Lin <ken.lin@hpe.com>
f725e3
---
f725e3
 grub-core/net/drivers/efi/efinet.c | 14 +++++---------
f725e3
 1 file changed, 5 insertions(+), 9 deletions(-)
f725e3
f725e3
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
f725e3
index 3bea6221745..a161e7a5f26 100644
f725e3
--- a/grub-core/net/drivers/efi/efinet.c
f725e3
+++ b/grub-core/net/drivers/efi/efinet.c
f725e3
@@ -475,9 +475,6 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
f725e3
   grub_err_t err;
f725e3
 
f725e3
   ddp = grub_efi_duplicate_device_path (dp);
f725e3
-  if (!ddp)
f725e3
-    return NULL;
f725e3
-
f725e3
   ldp = grub_efi_find_last_device_path (ddp);
f725e3
 
f725e3
   if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
f725e3
@@ -754,7 +751,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
f725e3
   {
f725e3
     grub_efi_device_path_t *cdp;
f725e3
     struct grub_efi_pxe *pxe;
f725e3
-    struct grub_efi_pxe_mode *pxe_mode;
f725e3
+    struct grub_efi_pxe_mode *pxe_mode = NULL;
f725e3
     grub_uint8_t *packet_buf;
f725e3
     grub_size_t packet_bufsz ;
f725e3
     int ipv6;
f725e3
@@ -841,11 +838,10 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
f725e3
     if (ipv6)
f725e3
       {
f725e3
 	grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
f725e3
-	grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
f725e3
-		      pxe_mode->dhcp_ack_received ? "yes" : "no",
f725e3
-		      pxe_mode->dhcp_ack_received ? "" : " cannot continue");
f725e3
-	if (!pxe_mode->dhcp_ack_received)
f725e3
-	  continue;
f725e3
+	if (pxe_mode)
f725e3
+	  grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
f725e3
+			pxe_mode->dhcp_ack_received ? "yes" : "no",
f725e3
+			pxe_mode->dhcp_ack_received ? "" : " cannot continue");
f725e3
 
f725e3
 	grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
f725e3
 					    (struct grub_net_dhcp6_packet *)