Add proxy dhcp support

This commit is contained in:
cdadmin 2017-12-21 12:59:56 -05:00 committed by Peter Jones
parent bc3b6525d8
commit 5f4fd53641

View File

@ -257,10 +257,20 @@ static EFI_STATUS parseDhcp4()
{ {
CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR); CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR);
INTN template_len = strlen(template) + 1; INTN template_len = strlen(template) + 1;
EFI_PXE_BASE_CODE_DHCPV4_PACKET* pkt_v4 = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck.Dhcpv4;
INTN dir_len = strnlena(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile, 127); if(pxe->Mode->ProxyOfferReceived) {
/*
* Proxy should not have precedence. Check if DhcpAck
* contained boot info.
*/
if(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile[0] == '\0')
pkt_v4 = &pxe->Mode->ProxyOffer.Dhcpv4;
}
INTN dir_len = strnlena(pkt_v4->BootpBootFile, 127);
INTN i; INTN i;
UINT8 *dir = pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile; UINT8 *dir = pkt_v4->BootpBootFile;
for (i = dir_len; i >= 0; i--) { for (i = dir_len; i >= 0; i--) {
if (dir[i] == '/') if (dir[i] == '/')
@ -281,7 +291,7 @@ static EFI_STATUS parseDhcp4()
if (dir_len == 0 && dir[0] != '/' && template[0] == '/') if (dir_len == 0 && dir[0] != '/' && template[0] == '/')
template++; template++;
strcata(full_path, template); strcata(full_path, template);
memcpy(&tftp_addr.v4, pxe->Mode->DhcpAck.Dhcpv4.BootpSiAddr, 4); memcpy(&tftp_addr.v4, pkt_v4->BootpSiAddr, 4);
return EFI_SUCCESS; return EFI_SUCCESS;
} }