refine the code and add more security check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9691 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Interface routines for PxeBc.
|
||||
|
||||
Copyright (c) 2007 - 2009, Intel Corporation.<BR>
|
||||
|
||||
Copyright (c) 2007 - 2010, Intel Corporation.<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -61,8 +61,8 @@ UpdateArpCache (
|
||||
);
|
||||
for (Index = 0; Index < Mode->ArpCacheEntries; Index ++) {
|
||||
CopyMem (
|
||||
&Mode->ArpCache[Index].IpAddr,
|
||||
Entries + 1,
|
||||
&Mode->ArpCache[Index].IpAddr,
|
||||
Entries + 1,
|
||||
Entries->SwAddressLength
|
||||
);
|
||||
CopyMem (
|
||||
@@ -98,12 +98,12 @@ ArpCacheUpdateTimeout (
|
||||
|
||||
/**
|
||||
Do arp resolution from arp cache in PxeBcMode.
|
||||
|
||||
|
||||
@param PxeBcMode The PXE BC mode to look into.
|
||||
@param Ip4Addr The Ip4 address for resolution.
|
||||
@param MacAddress The resoluted MAC address if the resolution is successful.
|
||||
The value is undefined if resolution fails.
|
||||
|
||||
|
||||
@retval TRUE The resolution is successful.
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
@@ -243,7 +243,7 @@ IcmpErrorListenHandler (
|
||||
QueueDpc (TPL_CALLBACK, IcmpErrorListenHandlerDpc, Context);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Enables the use of the PXE Base Code Protocol functions.
|
||||
|
||||
This function enables the use of the PXE Base Code Protocol functions. If the
|
||||
@@ -290,22 +290,22 @@ IcmpErrorListenHandler (
|
||||
TftpErrorZero-filled.
|
||||
MakeCallbacksSet to TRUE if the PXE Base Code Callback Protocol is available.
|
||||
Set to FALSE if the PXE Base Code Callback Protocol is not available.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param UseIpv6 Specifies the type of IP addresses that are to be used during the session
|
||||
that is being started. Set to TRUE for IPv6 addresses, and FALSE for
|
||||
IPv4 addresses.
|
||||
|
||||
that is being started. Set to TRUE for IPv6 addresses, and FALSE for
|
||||
IPv4 addresses.
|
||||
|
||||
@retval EFI_SUCCESS The PXE Base Code Protocol was started.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this oper
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this oper
|
||||
@retval EFI_UNSUPPORTED UseIpv6 is TRUE, but the Ipv6Supported field of the
|
||||
EFI_PXE_BASE_CODE_MODE structure is FALSE.
|
||||
@retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state.
|
||||
EFI_PXE_BASE_CODE_MODE structure is FALSE.
|
||||
@retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state.
|
||||
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the
|
||||
PXE Base Code Protocol.
|
||||
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the
|
||||
PXE Base Code Protocol.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -340,7 +340,7 @@ EfiPxeBcStart (
|
||||
// Configure the udp4 instance to let it receive data
|
||||
//
|
||||
Status = Private->Udp4Read->Configure (
|
||||
Private->Udp4Read,
|
||||
Private->Udp4Read,
|
||||
&Private->Udp4CfgData
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -431,22 +431,22 @@ ON_EXIT:
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Disables the use of the PXE Base Code Protocol functions.
|
||||
|
||||
This function stops all activity on the network device. All the resources allocated
|
||||
in Start() are released, the Started field of the EFI_PXE_BASE_CODE_MODE structure is
|
||||
set to FALSE and EFI_SUCCESS is returned. If the Started field of the EFI_PXE_BASE_CODE_MODE
|
||||
structure is already FALSE, then EFI_NOT_STARTED will be returned.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The PXE Base Code Protocol was stopped.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -508,7 +508,7 @@ EfiPxeBcStop (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6
|
||||
S.A.R.R (solicit / advertise / request / reply) sequence.
|
||||
|
||||
@@ -524,22 +524,22 @@ EfiPxeBcStop (
|
||||
caller. If the DHCP sequence does not complete, then EFI_TIMEOUT will be returned.
|
||||
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
|
||||
then the DHCP sequence will be stopped and EFI_ABORTED will be returned.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param SortOffers TRUE if the offers received should be sorted. Set to FALSE to try the
|
||||
offers in the order that they are received.
|
||||
|
||||
offers in the order that they are received.
|
||||
|
||||
@retval EFI_SUCCESS Valid DHCP has completed.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete the DHCP Protocol.
|
||||
@retval EFI_ABORTED The callback function aborted the DHCP Protocol.
|
||||
@retval EFI_TIMEOUT The DHCP Protocol timed out.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received during the DHCP session.
|
||||
@retval EFI_NO_RESPONSE Valid PXE offer was not received.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -596,7 +596,7 @@ EfiPxeBcDhcp (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Zero those arrays to record the varies numbers of DHCP OFFERS.
|
||||
//
|
||||
@@ -688,7 +688,7 @@ ON_EXIT:
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Attempts to complete the PXE Boot Server and/or boot image discovery sequence.
|
||||
|
||||
This function attempts to complete the PXE Boot Server and/or boot image discovery
|
||||
@@ -710,26 +710,26 @@ ON_EXIT:
|
||||
additional details on the implementation of the Discovery sequence.
|
||||
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
|
||||
then the Discovery sequence is stopped and EFI_ABORTED will be returned.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param Type The type of bootstrap to perform.
|
||||
@param Layer Pointer to the boot server layer number to discover, which must be
|
||||
PXE_BOOT_LAYER_INITIAL when a new server type is being
|
||||
discovered.
|
||||
@param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise.
|
||||
PXE_BOOT_LAYER_INITIAL when a new server type is being
|
||||
discovered.
|
||||
@param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise.
|
||||
@param Info Pointer to a data structure that contains additional information on the
|
||||
type of discovery operation that is to be performed.
|
||||
|
||||
type of discovery operation that is to be performed.
|
||||
|
||||
@retval EFI_SUCCESS The Discovery sequence has been completed.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete Discovery.
|
||||
@retval EFI_ABORTED The callback function aborted the Discovery sequence.
|
||||
@retval EFI_TIMEOUT The Discovery sequence timed out.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received during the PXE discovery
|
||||
session.
|
||||
|
||||
session.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -819,8 +819,8 @@ EfiPxeBcDiscover (
|
||||
// Get the multicast discover ip address from vendor option.
|
||||
//
|
||||
CopyMem (
|
||||
&DefaultInfo.ServerMCastIp.Addr,
|
||||
&VendorOpt->DiscoverMcastIp,
|
||||
&DefaultInfo.ServerMCastIp.Addr,
|
||||
&VendorOpt->DiscoverMcastIp,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
}
|
||||
@@ -882,8 +882,8 @@ EfiPxeBcDiscover (
|
||||
Private->ServerIp.Addr[0] = SrvList[Index].IpAddr.Addr[0];
|
||||
} else {
|
||||
CopyMem (
|
||||
&Private->ServerIp,
|
||||
&BootSvrEntry->IpAddr[Index],
|
||||
&Private->ServerIp,
|
||||
&BootSvrEntry->IpAddr[Index],
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
}
|
||||
@@ -942,8 +942,8 @@ EfiPxeBcDiscover (
|
||||
|
||||
if (Mode->PxeBisReplyReceived) {
|
||||
CopyMem (
|
||||
&Private->ServerIp,
|
||||
&Mode->PxeReply.Dhcpv4.BootpSiAddr,
|
||||
&Private->ServerIp,
|
||||
&Mode->PxeReply.Dhcpv4.BootpSiAddr,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
}
|
||||
@@ -952,7 +952,7 @@ EfiPxeBcDiscover (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Used to perform TFTP and MTFTP services.
|
||||
|
||||
This function is used to perform TFTP and MTFTP services. This includes the
|
||||
@@ -997,31 +997,31 @@ EfiPxeBcDiscover (
|
||||
IP address preceding the filename of the form %d.%d.%d.%d for IP v4. The final
|
||||
entry is itself null-terminated, so that the final information string is terminated
|
||||
with two null octets.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param Operation The type of operation to perform.
|
||||
@param BufferPtr A pointer to the data buffer.
|
||||
@param BufferPtr A pointer to the data buffer.
|
||||
@param Overwrite Only used on write file operations. TRUE if a file on a remote server can
|
||||
be overwritten.
|
||||
be overwritten.
|
||||
@param BufferSize For get-file-size operations, *BufferSize returns the size of the
|
||||
requested file.
|
||||
requested file.
|
||||
@param BlockSize The requested block size to be used during a TFTP transfer.
|
||||
@param ServerIp The TFTP / MTFTP server IP address.
|
||||
@param Filename A Null-terminated ASCII string that specifies a directory name or a file
|
||||
name.
|
||||
name.
|
||||
@param Info Pointer to the MTFTP information.
|
||||
@param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation.
|
||||
|
||||
@param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation.
|
||||
|
||||
@retval EFI_SUCCESS The TFTP/MTFTP operation was completed.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation.
|
||||
@retval EFI_ABORTED The callback function aborted the TFTP/MTFTP operation.
|
||||
@retval EFI_TIMEOUT The TFTP/MTFTP operation timed out.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received during the MTFTP session.
|
||||
@retval EFI_TFTP_ERROR A TFTP error packet was received during the MTFTP session.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -1076,23 +1076,23 @@ EfiPxeBcMtftp (
|
||||
Mtftp4Config.TryCount = PXEBC_MTFTP_RETRIES;
|
||||
|
||||
CopyMem (
|
||||
&Mtftp4Config.StationIp,
|
||||
&Private->StationIp,
|
||||
&Mtftp4Config.StationIp,
|
||||
&Private->StationIp,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
CopyMem (
|
||||
&Mtftp4Config.SubnetMask,
|
||||
&Private->SubnetMask,
|
||||
&Mtftp4Config.SubnetMask,
|
||||
&Private->SubnetMask,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
CopyMem (
|
||||
&Mtftp4Config.GatewayIp,
|
||||
&Private->GatewayIp,
|
||||
&Mtftp4Config.GatewayIp,
|
||||
&Private->GatewayIp,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
CopyMem (
|
||||
&Mtftp4Config.ServerIp,
|
||||
ServerIp,
|
||||
&Mtftp4Config.ServerIp,
|
||||
ServerIp,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
|
||||
@@ -1172,7 +1172,7 @@ EfiPxeBcMtftp (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Writes a UDP packet to the network interface.
|
||||
|
||||
This function writes a UDP packet specified by the (optional HeaderPtr and)
|
||||
@@ -1185,29 +1185,29 @@ EfiPxeBcMtftp (
|
||||
the IcmpErrorReceived field is set to TRUE, the IcmpError field is filled in and
|
||||
EFI_ICMP_ERROR will be returned. If the Callback Protocol does not return
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param OpFlags The UDP operation flags.
|
||||
@param OpFlags The UDP operation flags.
|
||||
@param DestIp The destination IP address.
|
||||
@param DestPort The destination UDP port number.
|
||||
@param GatewayIp The gateway IP address.
|
||||
@param DestPort The destination UDP port number.
|
||||
@param GatewayIp The gateway IP address.
|
||||
@param SrcIp The source IP address.
|
||||
@param SrcPort The source UDP port number.
|
||||
@param HeaderSize An optional field which may be set to the length of a header at
|
||||
HeaderPtr to be prefixed to the data at BufferPtr.
|
||||
HeaderPtr to be prefixed to the data at BufferPtr.
|
||||
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
|
||||
data at BufferPtr.
|
||||
data at BufferPtr.
|
||||
@param BufferSize A pointer to the size of the data at BufferPtr.
|
||||
@param BufferPtr A pointer to the data to be written.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The UDP Write operation was completed.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted.
|
||||
@retval EFI_ABORTED The callback function aborted the UDP Write operation.
|
||||
@retval EFI_TIMEOUT The UDP Write operation timed out.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session.
|
||||
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -1407,20 +1407,20 @@ CheckIpByFilter (
|
||||
}
|
||||
|
||||
CopyMem (&DestIp4Address, &Session->DestinationAddress, sizeof (DestIp4Address));
|
||||
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) &&
|
||||
if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0) &&
|
||||
IP4_IS_MULTICAST (EFI_NTOHL (DestIp4Address))
|
||||
) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) &&
|
||||
if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) &&
|
||||
IP4_IS_LOCAL_BROADCAST (EFI_NTOHL (DestIp4Address))
|
||||
) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CopyMem (&Ip4Address, &PxeBcMode->StationIp.v4, sizeof (Ip4Address));
|
||||
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) &&
|
||||
if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) &&
|
||||
EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)
|
||||
) {
|
||||
return TRUE;
|
||||
@@ -1430,8 +1430,8 @@ CheckIpByFilter (
|
||||
|
||||
for (Index = 0; Index < PxeBcMode->IpFilter.IpCnt; Index++) {
|
||||
CopyMem (
|
||||
&Ip4Address,
|
||||
&PxeBcMode->IpFilter.IpList[Index].v4,
|
||||
&Ip4Address,
|
||||
&PxeBcMode->IpFilter.IpList[Index].v4,
|
||||
sizeof (Ip4Address)
|
||||
);
|
||||
if (EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)) {
|
||||
@@ -1442,7 +1442,7 @@ CheckIpByFilter (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Reads a UDP packet from the network interface.
|
||||
|
||||
This function reads a UDP packet from a network interface. The data contents
|
||||
@@ -1453,31 +1453,31 @@ CheckIpByFilter (
|
||||
contents of BufferPtr are undefined, and the packet is lost. If a UDP packet is
|
||||
successfully received, then EFI_SUCCESS will be returned, and the information
|
||||
from the UDP header will be returned in DestIp, DestPort, SrcIp, and SrcPort if
|
||||
they are not NULL. Depending on the values of OpFlags and the DestIp, DestPort,
|
||||
SrcIp, and SrcPort input values, different types of UDP packet receive filtering
|
||||
they are not NULL. Depending on the values of OpFlags and the DestIp, DestPort,
|
||||
SrcIp, and SrcPort input values, different types of UDP packet receive filtering
|
||||
will be performed. The following tables summarize these receive filter operations.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param OpFlags The UDP operation flags.
|
||||
@param OpFlags The UDP operation flags.
|
||||
@param DestIp The destination IP address.
|
||||
@param DestPort The destination UDP port number.
|
||||
@param SrcIp The source IP address.
|
||||
@param SrcPort The source UDP port number.
|
||||
@param HeaderSize An optional field which may be set to the length of a header at
|
||||
HeaderPtr to be prefixed to the data at BufferPtr.
|
||||
HeaderPtr to be prefixed to the data at BufferPtr.
|
||||
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
|
||||
data at BufferPtr.
|
||||
data at BufferPtr.
|
||||
@param BufferSize A pointer to the size of the data at BufferPtr.
|
||||
@param BufferPtr A pointer to the data to be read.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The UDP Read operation was completed.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_BUFFER_TOO_SMALL The packet is larger than Buffer can hold.
|
||||
@retval EFI_ABORTED The callback function aborted the UDP Read operation.
|
||||
@retval EFI_TIMEOUT The UDP Read operation timed out.
|
||||
|
||||
@retval EFI_TIMEOUT The UDP Read operation timed out.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -1676,8 +1676,8 @@ TRY_AGAIN:
|
||||
|
||||
*BufferSize = RxData->DataLength - CopyLen;
|
||||
CopyMem (
|
||||
BufferPtr,
|
||||
(UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen,
|
||||
BufferPtr,
|
||||
(UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen,
|
||||
*BufferSize
|
||||
);
|
||||
}
|
||||
@@ -1705,9 +1705,9 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Updates the IP receive filters of a network device and enables software filtering.
|
||||
|
||||
|
||||
The NewFilter field is used to modify the network device's current IP receive
|
||||
filter settings and to enable a software filter. This function updates the IpFilter
|
||||
field of the EFI_PXE_BASE_CODE_MODE structure with the contents of NewIpFilter.
|
||||
@@ -1728,14 +1728,14 @@ ON_EXIT:
|
||||
The IPlist field is used to enable IPs other than the StationIP. They may be
|
||||
multicast or unicast. If IPcnt is set as well as EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP,
|
||||
then both the StationIP and the IPs from the IPlist will be used.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param NewFilter Pointer to the new set of IP receive filters.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The IP receive filter settings were updated.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -1784,7 +1784,7 @@ EfiPxeBcSetIpFilter (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) &&
|
||||
(NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP)
|
||||
((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)
|
||||
) {
|
||||
//
|
||||
// If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList,
|
||||
@@ -1803,8 +1803,8 @@ EfiPxeBcSetIpFilter (
|
||||
Private->Udp4CfgData.AcceptBroadcast = FALSE;
|
||||
|
||||
if (PromiscuousNeed ||
|
||||
NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS ||
|
||||
NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST
|
||||
((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) != 0) ||
|
||||
((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0)
|
||||
) {
|
||||
//
|
||||
// Configure the udp4 filter to receive all packages
|
||||
@@ -1821,7 +1821,7 @@ EfiPxeBcSetIpFilter (
|
||||
|
||||
} else {
|
||||
|
||||
if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) {
|
||||
if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) {
|
||||
//
|
||||
// Configure the udp4 filter to receive all broadcast packages
|
||||
//
|
||||
@@ -1836,7 +1836,7 @@ EfiPxeBcSetIpFilter (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) {
|
||||
if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) {
|
||||
|
||||
for (Index = 0; Index < NewFilter->IpCnt; ++Index) {
|
||||
if (IP4_IS_MULTICAST (EFI_NTOHL (NewFilter->IpList[Index].v4))) {
|
||||
@@ -1862,32 +1862,32 @@ EfiPxeBcSetIpFilter (
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Uses the ARP protocol to resolve a MAC address.
|
||||
|
||||
|
||||
This function uses the ARP protocol to resolve a MAC address. The UsingIpv6 field
|
||||
of the EFI_PXE_BASE_CODE_MODE structure is used to determine if IPv4 or IPv6
|
||||
addresses are being used. The IP address specified by IpAddr is used to resolve
|
||||
a MAC address. If the ARP protocol succeeds in resolving the specified address,
|
||||
then the ArpCacheEntries and ArpCache fields of the EFI_PXE_BASE_CODE_MODE structure
|
||||
are updated, and EFI_SUCCESS is returned. If MacAddr is not NULL, the resolved
|
||||
MAC address is placed there as well. If the PXE Base Code protocol is in the
|
||||
stopped state, then EFI_NOT_STARTED is returned. If the ARP protocol encounters
|
||||
a timeout condition while attempting to resolve an address, then EFI_TIMEOUT is
|
||||
returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
|
||||
MAC address is placed there as well. If the PXE Base Code protocol is in the
|
||||
stopped state, then EFI_NOT_STARTED is returned. If the ARP protocol encounters
|
||||
a timeout condition while attempting to resolve an address, then EFI_TIMEOUT is
|
||||
returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
|
||||
then EFI_ABORTED is returned.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param IpAddr Pointer to the IP address that is used to resolve a MAC address.
|
||||
@param MacAddr If not NULL, a pointer to the MAC address that was resolved with the
|
||||
ARP protocol.
|
||||
|
||||
ARP protocol.
|
||||
|
||||
@retval EFI_SUCCESS The IP or MAC address was resolved.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_ICMP_ERROR Something error occur with the ICMP packet message.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
||||
@retval EFI_ICMP_ERROR Something error occur with the ICMP packet message.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -1948,9 +1948,9 @@ EfiPxeBcArp (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Updates the parameters that affect the operation of the PXE Base Code Protocol.
|
||||
|
||||
|
||||
This function sets parameters that affect the operation of the PXE Base Code Protocol.
|
||||
The parameter specified by NewAutoArp is used to control the generation of ARP
|
||||
protocol packets. If NewAutoArp is TRUE, then ARP Protocol packets will be generated
|
||||
@@ -1962,23 +1962,23 @@ EfiPxeBcArp (
|
||||
the EFI_PXE_BASE_CODE_MODE structure to NewAutoArp.
|
||||
The SetParameters() call must be invoked after a Callback Protocol is installed
|
||||
to enable the use of callbacks.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param NewAutoArp If not NULL, a pointer to a value that specifies whether to replace the
|
||||
current value of AutoARP.
|
||||
current value of AutoARP.
|
||||
@param NewSendGUID If not NULL, a pointer to a value that specifies whether to replace the
|
||||
current value of SendGUID.
|
||||
current value of SendGUID.
|
||||
@param NewTTL If not NULL, a pointer to be used in place of the current value of TTL,
|
||||
the "time to live" field of the IP header.
|
||||
the "time to live" field of the IP header.
|
||||
@param NewToS If not NULL, a pointer to be used in place of the current value of ToS,
|
||||
the "type of service" field of the IP header.
|
||||
the "type of service" field of the IP header.
|
||||
@param NewMakeCallback If not NULL, a pointer to a value that specifies whether to replace the
|
||||
current value of the MakeCallback field of the Mode structure.
|
||||
|
||||
current value of the MakeCallback field of the Mode structure.
|
||||
|
||||
@retval EFI_SUCCESS The new parameters values were updated.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -2073,9 +2073,9 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Updates the station IP address and/or subnet mask values of a network device.
|
||||
|
||||
|
||||
This function updates the station IP address and/or subnet mask values of a network
|
||||
device. The NewStationIp field is used to modify the network device's current IP address.
|
||||
If NewStationIP is NULL, then the current IP address will not be modified. Otherwise,
|
||||
@@ -2084,15 +2084,15 @@ ON_EXIT:
|
||||
mask. If NewSubnetMask is NULL, then the current subnet mask will not be modified.
|
||||
Otherwise, this function updates the SubnetMask field of the EFI_PXE_BASE_CODE_MODE
|
||||
structure with NewSubnetMask.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param NewStationIp Pointer to the new IP address to be used by the network device.
|
||||
@param NewSubnetMask Pointer to the new subnet mask to be used by the network device.
|
||||
|
||||
@param NewStationIp Pointer to the new IP address to be used by the network device.
|
||||
@param NewSubnetMask Pointer to the new subnet mask to be used by the network device.
|
||||
|
||||
@retval EFI_SUCCESS The new station IP address and/or subnet mask were updated.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -2163,36 +2163,36 @@ EfiPxeBcSetStationIP (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Updates the contents of the cached DHCP and Discover packets.
|
||||
|
||||
|
||||
The pointers to the new packets are used to update the contents of the cached
|
||||
packets in the EFI_PXE_BASE_CODE_MODE structure.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
|
||||
@param NewDhcpDiscoverValid Pointer to a value that will replace the current
|
||||
DhcpDiscoverValid field.
|
||||
DhcpDiscoverValid field.
|
||||
@param NewDhcpAckReceived Pointer to a value that will replace the current
|
||||
DhcpAckReceived field.
|
||||
DhcpAckReceived field.
|
||||
@param NewProxyOfferReceived Pointer to a value that will replace the current
|
||||
ProxyOfferReceived field.
|
||||
@param NewPxeDiscoverValid Pointer to a value that will replace the current
|
||||
ProxyOfferReceived field.
|
||||
ProxyOfferReceived field.
|
||||
@param NewPxeDiscoverValid Pointer to a value that will replace the current
|
||||
ProxyOfferReceived field.
|
||||
@param NewPxeReplyReceived Pointer to a value that will replace the current
|
||||
PxeReplyReceived field.
|
||||
PxeReplyReceived field.
|
||||
@param NewPxeBisReplyReceived Pointer to a value that will replace the current
|
||||
PxeBisReplyReceived field.
|
||||
@param NewDhcpDiscover Pointer to the new cached DHCP Discover packet contents.
|
||||
PxeBisReplyReceived field.
|
||||
@param NewDhcpDiscover Pointer to the new cached DHCP Discover packet contents.
|
||||
@param NewDhcpAck Pointer to the new cached DHCP Ack packet contents.
|
||||
@param NewProxyOffer Pointer to the new cached Proxy Offer packet contents.
|
||||
@param NewPxeDiscover Pointer to the new cached PXE Discover packet contents.
|
||||
@param NewPxeReply Pointer to the new cached PXE Reply packet contents.
|
||||
@param NewPxeBisReply Pointer to the new cached PXE BIS Reply packet contents.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The cached packet contents were updated.
|
||||
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@@ -2296,10 +2296,10 @@ EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has
|
||||
received, or is waiting to receive a packet.
|
||||
|
||||
received, or is waiting to receive a packet.
|
||||
|
||||
This function is invoked when the PXE Base Code Protocol is about to transmit, has received,
|
||||
or is waiting to receive a packet. Parameters Function and Received specify the type of event.
|
||||
Parameters PacketLen and Packet specify the packet that generated the event. If these fields
|
||||
@@ -2309,19 +2309,19 @@ EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate = {
|
||||
the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms.
|
||||
The SetParameters() function must be called after a Callback Protocol is installed to enable the
|
||||
use of callbacks.
|
||||
|
||||
|
||||
@param This Pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.
|
||||
@param Function The PXE Base Code Protocol function that is waiting for an event.
|
||||
@param Function The PXE Base Code Protocol function that is waiting for an event.
|
||||
@param Received TRUE if the callback is being invoked due to a receive event. FALSE if
|
||||
the callback is being invoked due to a transmit event.
|
||||
the callback is being invoked due to a transmit event.
|
||||
@param PacketLength The length, in bytes, of Packet. This field will have a value of zero if
|
||||
this is a wait for receive event.
|
||||
this is a wait for receive event.
|
||||
@param PacketPtr If Received is TRUE, a pointer to the packet that was just received;
|
||||
otherwise a pointer to the packet that is about to be transmitted.
|
||||
|
||||
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
|
||||
otherwise a pointer to the packet that is about to be transmitted.
|
||||
|
||||
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
|
||||
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT if Function specifies an abort operation
|
||||
|
||||
|
||||
**/
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS
|
||||
EFIAPI
|
||||
@@ -2398,15 +2398,15 @@ EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL mPxeBcCallBackTemplate = {
|
||||
/**
|
||||
Find the boot file.
|
||||
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param BufferSize Pointer to buffer size.
|
||||
@param Buffer Pointer to buffer.
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param BufferSize Pointer to buffer size.
|
||||
@param Buffer Pointer to buffer.
|
||||
|
||||
@retval EFI_SUCCESS Discover the boot file successfully.
|
||||
@retval EFI_TIMEOUT The TFTP/MTFTP operation timed out.
|
||||
@retval EFI_ABORTED PXE bootstrap server, so local boot need abort.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to load the boot file.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DiscoverBootFile (
|
||||
@@ -2492,8 +2492,8 @@ DiscoverBootFile (
|
||||
);
|
||||
} else {
|
||||
CopyMem (
|
||||
&Private->ServerIp,
|
||||
&Packet->Packet.Offer.Dhcp4.Header.ServerAddr,
|
||||
&Private->ServerIp,
|
||||
&Packet->Packet.Offer.Dhcp4.Header.ServerAddr,
|
||||
sizeof (EFI_IPv4_ADDRESS)
|
||||
);
|
||||
}
|
||||
@@ -2544,21 +2544,21 @@ DiscoverBootFile (
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param FilePath The device specific path of the file to load.
|
||||
@param BootPolicy If TRUE, indicates that the request originates from the
|
||||
@param BootPolicy If TRUE, indicates that the request originates from the
|
||||
boot manager is attempting to load FilePath as a boot
|
||||
selection. If FALSE, then FilePath must match as exact file
|
||||
to be loaded.
|
||||
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
||||
code of EFI_SUCCESS, the amount of data transferred to
|
||||
code of EFI_SUCCESS, the amount of data transferred to
|
||||
Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
|
||||
the size of Buffer required to retrieve the requested file.
|
||||
@param Buffer The memory buffer to transfer the file to. IF Buffer is NULL,
|
||||
then no the size of the requested file is returned in
|
||||
then no the size of the requested file is returned in
|
||||
BufferSize.
|
||||
|
||||
@retval EFI_SUCCESS The file was loaded.
|
||||
@retval EFI_UNSUPPORTED The device does not support the provided BootPolicy
|
||||
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
||||
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
||||
BufferSize is NULL.
|
||||
@retval EFI_NO_MEDIA No medium was present to load the file.
|
||||
@retval EFI_DEVICE_ERROR The file was not loaded due to a device error.
|
||||
@@ -2707,7 +2707,7 @@ EfiPxeLoadFile (
|
||||
if (Buffer != NULL) {
|
||||
AsciiPrint ("PXE-E05: Download buffer is smaller than requested file.\n");
|
||||
} else {
|
||||
PxeBc->Stop (PxeBc);
|
||||
PxeBc->Stop (PxeBc);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user