Blame SOURCES/0049-Check-PxeReplyReceived-as-fallback-in-netboot.patch

d1e1c8
From 9a209af5d84f4015ec399e1d1fa9dab31ef4d2b7 Mon Sep 17 00:00:00 2001
d1e1c8
From: Thomas Frauendorfer | Miray Software <tf@miray.de>
d1e1c8
Date: Wed, 25 Mar 2020 09:19:19 +0100
d1e1c8
Subject: [PATCH 49/62] Check PxeReplyReceived as fallback in netboot
d1e1c8
d1e1c8
Some mainboards do not update the ProxyOffset dhcp information when using
d1e1c8
proxy dhcp and boot menus.
d1e1c8
This adds a fallback to check the PxeReply field if no boot information is
d1e1c8
found in the v4 dhcp or proxy dhcp information
d1e1c8
d1e1c8
Upstream-commit-id: cc7ebe0f9f4
d1e1c8
---
d1e1c8
 netboot.c | 15 ++++++++++++---
d1e1c8
 1 file changed, 12 insertions(+), 3 deletions(-)
d1e1c8
 mode change 100644 => 100755 netboot.c
d1e1c8
d1e1c8
diff --git a/netboot.c b/netboot.c
d1e1c8
old mode 100644
d1e1c8
new mode 100755
d1e1c8
index 4922ef284b1..047dad3a760
d1e1c8
--- a/netboot.c
d1e1c8
+++ b/netboot.c
d1e1c8
@@ -273,7 +273,16 @@ static EFI_STATUS parseDhcp4()
d1e1c8
 			pkt_v4 = &pxe->Mode->ProxyOffer.Dhcpv4;
d1e1c8
 	}
d1e1c8
 
d1e1c8
-	INTN dir_len = strnlena(pkt_v4->BootpBootFile, 127);
d1e1c8
+	if(pxe->Mode->PxeReplyReceived) {
d1e1c8
+		/*
d1e1c8
+		 * If we have no bootinfo yet search for it in the PxeReply.
d1e1c8
+		 * Some mainboards run into this when the server uses boot menus
d1e1c8
+		 */
d1e1c8
+		if(pkt_v4->BootpBootFile[0] == '\0' && pxe->Mode->PxeReply.Dhcpv4.BootpBootFile[0] != '\0')
d1e1c8
+			pkt_v4 = &pxe->Mode->PxeReply.Dhcpv4;
d1e1c8
+	}
d1e1c8
+
d1e1c8
+	INTN dir_len = strnlena((CHAR8 *)pkt_v4->BootpBootFile, 127);
d1e1c8
 	INTN i;
d1e1c8
 	UINT8 *dir = pkt_v4->BootpBootFile;
d1e1c8
 
d1e1c8
@@ -289,7 +298,7 @@ static EFI_STATUS parseDhcp4()
d1e1c8
 		return EFI_OUT_OF_RESOURCES;
d1e1c8
 
d1e1c8
 	if (dir_len > 0) {
d1e1c8
-		strncpya(full_path, dir, dir_len);
d1e1c8
+		strncpya(full_path, (CHAR8 *)dir, dir_len);
d1e1c8
 		if (full_path[dir_len-1] == '/' && template[0] == '/')
d1e1c8
 			full_path[dir_len-1] = '\0';
d1e1c8
 	}
d1e1c8
@@ -340,7 +349,7 @@ EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle, VOID **buffer, UINT64 *buf
d1e1c8
 
d1e1c8
 try_again:
d1e1c8
 	efi_status = pxe->Mtftp(pxe, read, *buffer, overwrite, bufsiz, &blksz,
d1e1c8
-			      &tftp_addr, full_path, NULL, nobuffer);
d1e1c8
+			      &tftp_addr, (UINT8 *)full_path, NULL, nobuffer);
d1e1c8
 	if (efi_status == EFI_BUFFER_TOO_SMALL) {
d1e1c8
 		/* try again, doubling buf size */
d1e1c8
 		*bufsiz *= 2;
d1e1c8
-- 
d1e1c8
2.26.2
d1e1c8