nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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