diff options
| author | Thomas Frauendorfer | Miray Software <tf@miray.de> | 2020-03-25 09:19:19 +0100 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2020-07-23 20:53:24 -0400 |
| commit | 9a209af5d84f4015ec399e1d1fa9dab31ef4d2b7 (patch) | |
| tree | 2a021d6590647a640d499071794fbf9f405e22ea | |
| parent | 633169fe3291c832236ca1074fc679852f9caee1 (diff) | |
| download | efi-boot-shim-9a209af5d84f4015ec399e1d1fa9dab31ef4d2b7.tar.gz efi-boot-shim-9a209af5d84f4015ec399e1d1fa9dab31ef4d2b7.zip | |
Check PxeReplyReceived as fallback in netboot
Some mainboards do not update the ProxyOffset dhcp information when using
proxy dhcp and boot menus.
This adds a fallback to check the PxeReply field if no boot information is
found in the v4 dhcp or proxy dhcp information
Upstream-commit-id: cc7ebe0f9f4
| -rwxr-xr-x[-rw-r--r--] | netboot.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/netboot.c b/netboot.c index 4922ef28..047dad3a 100644..100755 --- a/netboot.c +++ b/netboot.c @@ -273,7 +273,16 @@ static EFI_STATUS parseDhcp4() pkt_v4 = &pxe->Mode->ProxyOffer.Dhcpv4; } - INTN dir_len = strnlena(pkt_v4->BootpBootFile, 127); + if(pxe->Mode->PxeReplyReceived) { + /* + * If we have no bootinfo yet search for it in the PxeReply. + * Some mainboards run into this when the server uses boot menus + */ + if(pkt_v4->BootpBootFile[0] == '\0' && pxe->Mode->PxeReply.Dhcpv4.BootpBootFile[0] != '\0') + pkt_v4 = &pxe->Mode->PxeReply.Dhcpv4; + } + + INTN dir_len = strnlena((CHAR8 *)pkt_v4->BootpBootFile, 127); INTN i; UINT8 *dir = pkt_v4->BootpBootFile; @@ -289,7 +298,7 @@ static EFI_STATUS parseDhcp4() return EFI_OUT_OF_RESOURCES; if (dir_len > 0) { - strncpya(full_path, dir, dir_len); + strncpya(full_path, (CHAR8 *)dir, dir_len); if (full_path[dir_len-1] == '/' && template[0] == '/') full_path[dir_len-1] = '\0'; } @@ -340,7 +349,7 @@ EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle, VOID **buffer, UINT64 *buf try_again: efi_status = pxe->Mtftp(pxe, read, *buffer, overwrite, bufsiz, &blksz, - &tftp_addr, full_path, NULL, nobuffer); + &tftp_addr, (UINT8 *)full_path, NULL, nobuffer); if (efi_status == EFI_BUFFER_TOO_SMALL) { /* try again, doubling buf size */ *bufsiz *= 2; |
