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

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